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*
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*
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Hey laserlight!
Got it.. Thanks for clearing that up!