viza <tom.viza@gm-il.com.obviouschange.invalidwrites:
Quote:
On Sun, 31 Aug 2008 23:27:48 -0700, Tinku wrote:
Quote:
>please forgive me if it is a stupid question because i dont understand
>I saw a question in C -
>>
>if (____)
>printf("welcome");
>else
>printf("to C world");
>>
>what should be the condition in if(___) for following output
>>
> welcome to C world
>
You have had several answers, all correct, but none very useful, as is to
be expected in comp.lang.c.
No useful answer is possible.
Quote:
In answer to your question, it is not possible make both the if and the
else happen, without using goto or something like that, which can get
confusing.
The problem statement didn't ask for a way to make both the if and the
else happen; it asked for a way to make the program produce the output
"welcome to C world". The printf("welcome") call was a deliberate red
herring.
[...]
A sufficiently good and clever C programmer should be able to solve
the problem as stated. Note that "good" and "clever" are not
synonymous. A sufficiently clever programmer might use such a trick
in production code; a good programmer never will.
--
Keith Thompson (The_Other_Keith)
kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"