c - In the below program I was expected Infinite loop as a output. But output is 0, please help me with explain the concept behind it -


void main() {         int i;      int s=0;      while(i<30)      s+=i;      i++;      printf("sum %d",s); } 

/output 0,how? expecting infinite loop./

i uninitialized. can have value. if has value greater/equal 30, loop not execute , s remains 0.


Comments

Popular posts from this blog

java - Checkbox item adds to spinner -

php - mySQL problems with this code? -

C# MVC AngularJS -