{
int i=1;
while(i<=32767)
{
printf("%d",i);
i=i+1;
}
}
It seems a simple program to print 1 to 32767 ...but when i reaches 32767 ...on incrementing value by 1.....it tries to go to 32768 which falls outside the range of integer and goes to other side that is -32768 .....due to which condition becomes true as i<=32767 i.e. -32768.....So it should work as indefinite loop. My Dev C++ Compiler prints only 1 to 32767....its not working as indefinite loop. Anybody