2

I was just curious to do it and find the result, but I got really shocked...

Actually,

when we do this:

for(i=0; 0; i++)
 printf("hello");

it prints hello... which it should not.

and if do like this:

int a=0;
for(i=0;a;i++)
 printf("hello");

it doesn't print hello...

although the expected behavior is shown in if-else or while loop.. Can anyone explain?

alk
  • 68,300
  • 10
  • 92
  • 234
nsthethunderbolt
  • 2,079
  • 1
  • 16
  • 24

0 Answers0