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 condition; ++i, ++x )
Thanks
when you need to declare two variables of different types, it can't be done by one declaration
Hackety hack hack:
for (struct {int i; char c;} loop = {0, 'a'}; loop.i < 26; ++loop.i, ++loop.c)
{
std::cout << loop.c << '\n';
}
;-)
this works:
for( int i = 0, x = 0; some condition; ++i, ++x )
it's a variable declaration:
int i, j; // correct
int i, int j; // wrong, must not repeat type
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With