Increment decrement operators

pls explain me how the following is executed -
int x,y,z;
int x = 5;
int y = ++x * x–;
int z = ++y + --y;
what is the flow of code(left to right or right to left) and how it executes??

Hi sahil
precedence of unary(postfix, prefix) > binary operators(+,-,,/)
post/pre fix are done prior to binary operations
y = ++x * x–
first (++x) is done changing x=6 and then using the future value of x, then (x–) is done by using x=6 and updating x=6-1=5
now (++x) uses final x value of 5
to get y= 5
6=30

z = ++y + --y is done by doing (++y) and then (–y) causing y to remain same and z=y+y = 60
Its a bit complicated but you will learn with practice and concepts.
Hope it helps :)`

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.