Thank you! :D but since this is in a elseif(Boolean exoression) statement, would the value of j change from the original value. For instance. Let's say the value of j=2. After this Boolean exoression, would the value of j be changed to whatever that is?
Run this and it will explain to you exactly what is happening.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
int j = 10;
if(j-- == 9) // Checks to see if j is equivalent to 9. It isn't. Regardless it subtracts 1.
std::cout << "First expression: " << j; //Outputs 9
elseif(j-- == 9) // Checks to see if j is equivalent to 9. It is. Regardless it subtracts 1 again.
std::cout << "Second expression: " << j; //Outputs 8.
It checks to see if j is equivalent to whatever you're comparing it to before it does the operations on j.
I did run it and in fCt was playing around it with on visual studio. I do get it now but k=j-- I don't understand how the value of 3 is being stored for j. Can you explain to me how this expression is working step by step please. The original value of k and j are 4.