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

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -