Multiple Counter Problem In For Loop

后端 未结 7 1146
余生分开走
余生分开走 2020-12-16 10:59

Why is this not valid

for( int i = 0, int x = 0; some condition; ++i, ++x )

and this is

int i, x;
for( i = 0, x = 0; some c         


        
7条回答
  •  猫巷女王i
    2020-12-16 11:50

    Because a variable declaration (like int x) is not an expression and the comma operator (,) only combines expressions.

提交回复
热议问题