int i=5,j=6;
int k=i++ + i++ + ++i + i++;
int m=j++ + j++ + j++ - j++;
cout<<i;
cout<<m;
cout<<j;
cout<<k;

Recommended Answers

All 3 Replies

That should show you exactly how it works :) If you don't follow it, break it up into smaller statements: int m=n=j++ + j++; If you have specific questions let us know.

David

When you write equations like this, you are dealing with a whole lot of undefined behavior stemming from what are sometimes called "side effects". You should never write such a statement because the results are unpredictable at best.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.