C++ Increment Operators: ++a + b++ + c++ Explained
The result of the expression '++a + b++ + c++' is 38.
Here is the explanation:
- The prefix increment operator '++a' increments the value of 'a' by 1, so 'a' becomes 3.
- The value of 'b' is 31.
- The postfix increment operator 'b++' increments the value of 'b' by 1 after it is used in the expression, so the value of 'b' used in the expression is still 31.
- The value of 'c' is 4.
- The postfix increment operator 'c++' increments the value of 'c' by 1 after it is used in the expression, so the value of 'c' used in the expression is still 4.
- The expression becomes 3 + 31 + 4 = 38.
原文地址: https://www.cveoy.top/t/topic/mJ3K 著作权归作者所有。请勿转载和采集!