I have a basic doubt...
When we use the post incrment operator the incremnet of the
variable is done after the execution of the statemnt?????
for eg
int i=1;
printf("%d %d",i++,i++);
shud the answer be 1 1
or 1 2
i want to understand the execution pt
the problem is that you don't know when the ++ operations are carried out (it is side effect) - they may done immediatly after the operand is used or saved until the end of the statement. For example, gcc and Borland CBuilder V5 gave
2 1
whereas Visual C 5.0 gave
1 1
in all cases the final value of i was 3
in general the advice is do not use a variable more than once in an expression if one (or more) of the references has a ++ or -- attached to it.