typedef struct piece Piece;
struct piece{
char color;
char symbol;
};
int readPiece(Piece * p[]);
// Because my code is quite long . I didn't put all of them here.
int main(void){
int row = 0;
int col = 0;
Piece input[LEN][LEN];
readPiece(input);
return 0;
}
//read in 16*2 specific characters .
int readPiece(Piece * p[]){
int row = 0;
int col = 0;
while(row < LEN){
col = 0;
while(col < LEN){
scanf("%c%c",&(p[row][col] .color), &(p[row][col].symbol));
if((p[row][col].color == 'R' || p[row][col].color == 'G' || p[row][col].color == 'B' || p[row][col].color == 'Y') && (p[row][col] . symbol == '*' || p[row][col].symbol == '^' || p[row][col].symbol == '#' || p[row][col].symbol == '$')){
getchar();
}else{
return 0;
}
col ++;
}
row ++;
}
return 1;
}
// I just start learning C language. I try to pass a 2d struct by pointer into a function but when I compile it , it shows 'incompatible pointer types passing'. So I wanna ask what's the right way to pass a 2d struct into a function and why mine is not working. Thanks.