PLz help me to solve a problem..
May 25, 2013 at 8:25pm UTC
Any tell me what does this code mean ?
for ( printf("0");!printf("1");printf("0") );
May 25, 2013 at 9:03pm UTC
It prints "01"
That code is actually nonsense and doesn't mean anything.
Where did you get it?
May 25, 2013 at 9:10pm UTC
I got this ques in my technical interview.
The answer is "100".but i didn't know that how this code work .
May 25, 2013 at 9:18pm UTC
Nope, it is 01.
I have even tested it.
http://ideone.com/Ys4nCd
First printf("0") (initialisation operation) executes and prints 0.
Executes loop variable (!printf("1")): printf("1") prints 1 and returns 1. It got negated and 0 is checked for trueness. It is false, so loop terminates.
Whoever said th it is 100 is wrong here.
Last edited on May 25, 2013 at 9:18pm UTC
May 25, 2013 at 9:43pm UTC
Thanks sir.your ans is highly appreciable for me.
Topic archived. No new replies allowed.