Because for-loop needs 3 parameters. If you just give 2 parameters with 3rd parameter not being given, compiler expects the loop variant parameter there. Usually –
for(iteration variable; condition; increment/decrement )
for(;condition;increment/decrement ){}
for(iteration variable;;increment/decrement) {}
for(;;increment/decrement) {}
...
1
solved This just bugs me [closed]