Control Instructions in C -


i not understanding loop statement , expression following it. please me understand.

#include<stdio.h>  int main() {    int x = 1;    int y = 1;    for( ; y ; printf("%d %d\n",x,y))        y = x++ <= 5;    return 0; } 

and output got

2 1 3 1 4 1 5 1 6 1 7 0 

y = x++ <= 5; ==> y = (x++ <= 5); ==> first compare x 5 check whether x small or equals 5 or not. result of (x++ <= 5) either 1, 0 assigned y,

as x becomes > 5, (x++ <= 5) becomes 0 y = 0 , condition false , loop break,


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -