c - Why does the print statement not get executed at all? -
this program:
#include<stdio.h> int main() { int i=(-5); while(i<=5){ if (i>=0){ break; } else{ i++; continue; } printf("hello\n"); } return 0; } my question is, why 'hello' not printed @ all?
because have used continue incorrectly. stops line after , goes condition checking part of while loop. that's why doesn't print hello.
from standard $6.8.6.2
a continue statement causes jump loop-continuation portion of smallest enclosing iteration statement; is, end of loop body.
Comments
Post a Comment