Hello all,
New to the forum and C++. I am not entirely clear on the proper usage of increment operators.
What means x = x +1?
x++
or
++x?
Also, which one means "get current value of x"?
thank you so much in advanced
spark*
This is a discussion on increment operator syntax within the C++ Programming forums, part of the General Programming Boards category; Hello all, New to the forum and C++. I am not entirely clear on the proper usage of increment operators. ...
Hello all,
New to the forum and C++. I am not entirely clear on the proper usage of increment operators.
What means x = x +1?
x++
or
++x?
Also, which one means "get current value of x"?
thank you so much in advanced
spark*
If you use them as stand-alone statements: both. Otherwise: neither.Originally Posted by spark*
Neither. If you want x, write x. However, if you are using an increment operator in a larger expression and want the current value of x, then post-increment (x++) makes sense.Originally Posted by spark*
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
Hey laserlight!
Got it.. Thanks for clearing that up!