Main.cc: In function ‘int main()’: Main.cc:21:32: error: expected ‘;’ before ‘]’ token if(a[i][j-1]=='.') a[i][j-1]]='!'; ^ Main.cc:21:31: warning: statement has no effect [-Wunused-value] if(a[i][j-1]=='.') a[i][j-1]]='!'; ~~~~~~~~^