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

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -