Does anyone see any syntax error on the following line?
int a6[3][2]={{0,0},{0,0},{0,0}};
for (int c=0 ; c<3 ; for(int c2=0 ; c2<2 ; cout<<a6[c++][c2++])) ;
It gives the following syntax error:
error C2143: syntax error: missing ')' before 'for'
error C2059: syntax error: ')'
The
forcommand is not an expression that you can use for the post-increment part of anotherfor. Put it outside the control statements of the loop.The code gets more readable if you keep with the common convention on how to write a loop, i.e. the code controlling the loop inside the
forstatement and the work to be done after it:This also fixes the bug that you have in your code, i.e. that you are incrementing
cfor every value that you show, while you should only increment it for every second value that you show.