If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: the result of the following expressions

Let me ask you, what did you expect the answer to be for any of these expressions?

The problem is that there is no answer. There is no guarantee when d++ or ++d will be executed in that block of code. There is something called a "sequence point" in C++, and I suggest you do a google search for that term.

Re: the result of the following expressions

i know the sequence but i can figure out these examples i run it in c++ and the results are different from those i made on the paper
that the reason i ask or help i anyone can explain how can calculate them
thanks

Re: the result of the following expressions

Again, there is no guarantee how C++ will calculate those lines. There is no "sequence" that is guaranteed to occur.

i run it in c++ and the results are different from those i made on the paper

So tell us, what did you do "on paper"? Did you just assume that "++d", "+=", "-=", and "d++" were supposed to always do things in a certain order if they appear in a single line of code? If you did assume this, then you're wrong.

Again, read the link I gave you. Simply put, if you have prefix, postfix, addition, subtraction on one line of code like that, then the behaviour of the program is undefined.

that the reason i ask or help i anyone can explain how can calculate them