void main()
{
int i=3;
printf("%d,%d,%d",i,i++,++i);
getch();
}
o/p:
5,4,4
if we r using ++i it will increment and it will asign to i so ans is 4
if we r using i++ it will increment but it assign to i so ans is 4
b'coz of i++ i value is 5.for clarifications execute the program

Not only is your example horribly broken, it's not even a valid example of the point you're trying to make.

>void main()
Implementation-defined behavior. main is required to return int.

>printf("%d,%d,%d",i,i++,++i);
Undefined behavior. The commas in an argument list do not constitute sequence points, and ++ modifies its operand.
Undefined behavior. You didn't include stdio.h, and functions that take variable arguments require a prototype in scope.

>getch();
Implementation-defined behavior. You didn't include a header that declares getch, and getch isn't a standard function.

Haahaa, good one Narue, But hell yeah that example will only give out errors.

Btw, balu116, please use the code tags. Posting source code like that is rude.

When did this become the noob gets it wrong thread?

It seems a magnet for 1-post people to chip in with their "interpretation" only to be corrected for getting some aspect of "side effect" or "sequence point" wrong.

xD but it can't be helped but corrected. Since others who are new here might get it wrong (which happens a lot). A good code writing practice is always appreciated.

int i=10;
cout << ++i << i++ << ++i;

using Borland C++, the output will be: 131111
instead of the expected output: 111112

Why is it?

Try reading the thread.

commented: thanks for finally staking this zombie to the ground! +17