What is my syntax error in this c code? -


i have written c code checking checkmate (in chess), can't understand what's wrong syntax, compile error:

main.c:2:30: error: expected ';', ',' or ')' before 'board'            int is_check(const char[][8] board,int i,int j){                                                       ^                                                                                                                                                  main.c:117:27: error: expected ';', ',' or ')' before 'board'           int check(const char[][8] board) 

and code:

#include <stdio.h> int is_check(const char[][8] board,int i,int j){ int row = i; int clmn = j; //check clmn ,   do{   i--;   }   while(board[i][j] == 'z');    if(i>=0){   if(board[i][j] == 'h'){     return 1;    } }  = row;//init  //check clmn , down   do{   i++;  } while(board[i][j] == 'z'); if(i<8){  if(board[i][j] == 'h'){    return 1;    } }  = row;//init  //check row ,  do{   j--;   }   while(board[i][j] == 'z'); if(j>=0){   if(board[i][j] == 'h'){     return 1;    } }  j = clmn;//init  //check row , down  do{   j++;   }   while(board[i][j] == 'z'); if(j<8){   if(board[i][j] == 'h'){     return 1;    }  }  j = clmn;//init  //check orib!4 do{ j++; i++; } while(board[i][j] == 'z'); if(j<8 && i<8){ if(board[i][j] == 'h'){ return 1; } }  j = clmn; = row;  //check orib!1 do{ j++; i--; } while(board[i][j] == 'z'); if(j<8 && i>=0){ if(board[i][j] == 'h'){ return 1; } }  j = clmn; = row;  //check orib!3 do{ j--; i++; } while(board[i][j] == 'z'); if(j>=0 && i<8){ if(board[i][j] == 'h'){ return 1; } }  j = clmn; = row;  //check orib!2 do{ j--; i--; } while(board[i][j] == 'z'); if(j>=0 && i>=0){ if(board[i][j] == 'h'){ return 1; } } return 0;  }//end func  int check(const char[][8] board) { int = 0; int j = 0; for(;i<8;i++){  for(;j<8;j++){   if(board[i][j] == 'q')    return is_check(board,i,j); } } return 0; }  int main(){ char x[8][8] ={{'r','z','b','q','h','z','q','r'},                {'a','a','a','a','z','z','a','a'},                {'z','z','z','d','z','z','d','z'},                {'z','z','z','z','z','z','z','b'},                {'z','z','z','z','a','z','z','z'},                {'a','z','z','a','z','z','z','z'},                {'z','a','a','z','z','a','a','a'},                {'r','d','b','z','h','z','z','r'}}; printf("%d",check(x)); return 0; } 

because should

const char board[][8]; 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -