I'm working on creating a simple wordsearch generator but having a problem passing a two dimensional array through a function and editing the value inside. I have declared my array in main as such:
char tableValues[xsize-1][ysize-1];
I'm filling each point in the array with a - in main, then passing it through to a function that fills the array with random letters and returns.
void fillTable(char *tableValues){
for ( int i = 0 ; i < xsize ; i++ ){
for ( int j = 0 ; j < ysize ; j++ ){
if ( tableValues[i][j]=='-')
tableValues[i][j] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[rand () % 26];
}
}
}
My problem is that an error gets flagged at the "tableValues[i][j]" parts, I'm not sure how else I'd edit individual points in an array with pointers. Any help would be much appreciated, thanks
I am calling my function as
fillTable((char *)tableValues);