Richard Heathfield <> writes:
> Piyush Agarwal said:
>
>> void main
>> {
>> int x;
>> if(x)
>> printf("Hello");
>> else
>> printf("World");
>> }
>> What value can be given to x such that the output is "Hello
>> World"?
>
> The output of the program is undefined for no fewer than three different
> reasons. So it might well say "Hello World" as written. Or, of course, it
> might not.
>
> Until you understand what the three reasons are, I recommend that you spend
> less time with puzzle questions and more time with a good C book.
I see four reasons (one of which is unlikely to cause mere undefined
behavior).
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.