0
Addition cpp
Could i know why is the answer 4 not 5 https://code.sololearn.com/cgeRl6r6Q3FG/?ref=app
2 Réponses
+ 4
The ++ operator works differently based on where it is in relation to the variable. In line 8 within your program, you have the value of b set to be equal to a++, and because the ++ is following the variable, the value of a will only be incremented after the value of b is set to a. Because of this, b is then set to 3 and a is set to 4. Following that on line 9, you're outputting ++b, which increments b before printing it to the console, and because the value of b is 3, ++b would be equal to 4 which is printed after the operation is performed
+ 1
oh thanks bro❤️❤️