|
| huitlacoche (3) | |
| Hello, This is probably a simple issue but I haven't programmed c++ in several years. The incremental operator only seems to work one direction. It will add one for something like (++y) but not for (y++). As far as I remember it worked in both directions. Has this changed or is it a compiler-specific thing? I've tried a couple compilers (mingW and visual C++'s) and the results are the same. Obviously it isn't a huge issue since it still works in the opposite direction. I'm just wondering what other changes have happened in the meantime. thanks, ~mark | |
| Tevsky (91) | |||||||
Those are not identical operators. One is pre-increment (++x) and the other is post-increment (x++). The difference is pre-increment increments the value of the variable before the expression is evaluated, and so obviously post-increment increments the value after.
The output for this program would be
Whereas pre-increment
The output would be
| |||||||
| huitlacoche (3) | |
| Ah, I completely forgot how that worked. Thanks for clarifying! ~mark | |
This topic is archived - New replies not allowed.
