hey can anyone explain me the behavior of
should it not print 1 ?Code:printf("%d", i=10);
hey can anyone explain me the behavior of
should it not print 1 ?Code:printf("%d", i=10);
Why would you think it would print 1? I don't see a 1 anywhere in there, except as part of the number 10.
i think the evaluation i=10 will return true ie 1
i == 10 evaluates to 1 (if i is indeed equal to 10), but i = 10 evaluates to 10 (equality vs. assignment).
Last edited by itsme86; 01-10-2011 at 05:53 PM. Reason: Added necessity for i being equal to 10
If you understand what you're doing, you're not learning anything.
oh So thats the difference ..
Thanks a lot