Count the number of element in 2D char array
My program is to process the elements in a 2D array, it should return the totla number '9' count in the car board,
but I stop in the line ''countemptyPosition(char board[8][8]);'', it response with expression syntax, can someone help me to point my mistake? thk a lot.
Code:
#include <stdio.h>
int countemptyPosition(char board[8][8]){
int count, x,y;
for (x=0;x<8; x++) /* x from 0 to 7 */
for (y=0;y<8; y++) { /* y from 0 to 7 */
if (board[x][y]=='9') /* if=9 then increment count by 1*/
count++;}
return count;
}
int main(void){
int count;
char board[8][8]={0,7,5,6,8,3,5,3,0,6,5,6,4,8,5,9,0,2,1,6,4,1,1,1,0,1,5,6,9,3,4,3,0,2,5,6,4,3,1,3,0,4,6,6,9,3,5,0,0,4,5,6,4,3,5,1,0,4,5,6,4,3,5,3};
countemptyPosition(char board[8][8]);
printf("count=%d\n",count);
getchar();
}