Help with Tic Tac Toe program

void  checkMark(char array, int userInput){
    
    int c=1;
    for(int i=0;i<3;i++){     
        for(int j=0;j<3;j++){
            if(userInput==c){
                array[i][j]='X';    //error here
            }
        c++;
        }
    }
}


I am making a tic tac toe game. This function is to switch out the number with an 'X' in the array, but it keeps giving me an error to do with the subscripts with the array.

In function `void checkMark(char*, int)':
invalid types `char[int]' for array subscript
[Build Error] [main.o] Error 1

Can I not use i and j as the subscripts in a function? It works perfectly fine if I put it in the main code.
Last edited on
Anyone?? I really need help on this.
array is of type char. It is not an array.

1
2
3
void checkMark(char array[][3], int userInput) {
// ...
}
Topic archived. No new replies allowed.