The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Stan James:
Look at i++ as an expression. It returns i and as a side effect increments i. So in this case it returned 0 and set i=1. Then the assignement happened using the result of the expression which was 0.
I go with the advice, never combine these operators with anything else if you can help it. i++ is a perfectly nice line of code but anything longer gets scary.
Originally posted by Vinod Chandana:
This is really weird. I've tried a similar thing in C and C++, the value of i is one in both the cases. Try this thing too. i = (i++); Even this is returning 0!!!
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
This will depend on the C/C++ compiler you use. With other words: the result of this statement isn't defined in C++! (In Java, it is.)
Originally posted by Vinod Chandana:
That could be true. But I've tried a couple of compilers, it works fine. Think about i = (i++); It is really weird.
- Vinod.