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
  • 69,737
  • 10
  • 105
  • 255
nsthethunderbolt
  • 2,059
  • 1
  • 17
  • 24

0 Answers0