0
Why the output is 20? (for loop)
int a=0, b=20; for(;a<b;a++); cout<< a; Why the result is 20? Shouldnt it be 01234567...1516171819? I'm confused plz help
3 Answers
+ 2
ditch the semicolon at the end of the for loop
+ 1
Oh you are right!
This question is quite tricky to me. So the semicolon immediately end the loop?
Thanks for answering!!
+ 1
yes, In C and C++, a semicolon acts as a statement terminator.