how can I make a function to calculate number of mines near by?

I wrote as this.. but it does not work properly.

Code:int calculate() { int sum = 0; int i; int j; for(i=0; i<9; i++) for (j=0; j<9; j++) if (mines[i][j] != "*" ) { if(mines[i+1][j] = "*"); { sum = 1 + calculate (); } else if(mines[i+1][j+1] = "*"); { sum = 1 + calculate (); } else if(mines[i+1][j] = "*"); { sum = 1 + calculate (); } else if(mines[i+1][j-1] = "*"); { sum = 1 + calculate (); } else if(mines[i][j-1] = "*"); { sum = 1 + calculate (); } else if(mines[i-1][j-1] = "*"); { sum = 1 + calculate (); } else if(mines[i-1][j] = "*"); { sum = 1 + calculate (); } else(mines[i-1][j+1] = "*"); { sum = 1 + calculate (); } return sum; }