Multiple Counter Problem In For Loop

后端 未结 7 1127
余生分开走
余生分开走 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条回答
  • 2020-12-16 11:52

    This is legal:

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

    int x, int y is not a legal way of declaring variables;

    0 讨论(0)
提交回复
热议问题