Explain me the result of - z = ++a-y-- | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Explain me the result of - z = ++a-y--

Var a = 2 Var y = 1 z = ++a-y-- Why the answer is not : 3

12th Aug 2021, 5:33 PM
Ofir Salem
5 Answers
+ 2
Ofir Salem i am not sure what you don't understand . ++ or -- before a operand increases or decreases the value of operand in the expression first and then do assignment or any other operations . whereas ++ or -- after a operand only change the value of operand after the current expression is evaluated .
12th Aug 2021, 5:58 PM
Abhay
Abhay - avatar
+ 1
https://www.sololearn.com/learning/1130/ Check the comments as well if you still have any doubt.
12th Aug 2021, 5:47 PM
Abhay
Abhay - avatar
0
Abhay i steel don't understand
12th Aug 2021, 5:50 PM
Ofir Salem
0
Abhay ok, can you answer on the question in the top
12th Aug 2021, 6:59 PM
Ofir Salem
0
Ofir Salem i answered how the ++ and -- works and that should answer your question as well or you can just google about how post and pre increment and decrement operators work given you still didn't understand .
12th Aug 2021, 7:03 PM
Abhay
Abhay - avatar