0
For loop
is it possible to write a for loop with a body that is never executed?
2 Antworten
+ 5
int main(){
int i = 5;
for(; i<5;i++){
// some code here
}
return 0;
}
since i variable is initialized to 5 and 5 is not smaller than 5, the for loop will not be executed
0
just put a semicolon after for loop. It will terminate your for loop there itself.