Part 47 – Post-Decrement Operator
This week we will address the post-decrement operator. Let’s examine our code.
#include <iostream>
int main(void) {
int myNumber = 16;
int myNewNumber = myNumber--;
std::cout << myNewNumber << std::endl;
std::cout << myNumber << std::endl;
return 0;
}
As we compile we see 16 and 15 printed out respectively.
We see that in this scenario myNewNumber does get decremented as myNumber— takes the value of 16 and reduces it to 15.
Next week we will dive into the Debugging Post-Decrement Operator.
当前内容版权归 mytechnotalent 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 mytechnotalent .