The output is undefined. Depends on the compiler. + is not a sequence point which may result in undefined behavior
On Sat, Aug 28, 2010 at 5:05 PM, jagadish <[email protected]> wrote: > I ran this code.. > > int main() { int x=5; > printf("%d",(x++ + ++x + x++)); > } > > The output printed was 18 instead of 19.. Should it not be 19? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
