This is a discussion on n++ within the C and C++ Programming forums, part of the Software Development category; Hi all, why n++ executes faster than n+1? Sabita...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi, Possibly the most well known operator in C++; ++ is a unary operator that can be applied to variables and increments the value they hold. For example often for loops have, as their increment-expr something like:- counter++ why this is faster than the normal increment statement (n++ instead of n=n+1) , because normally the C++ compiler will compile or execute a statement from left to right compilation. Say for an example n=n+1; the compilation is like this But whereas in n++, the compiler will do This is why the ++ is faster than the normal calculation(increment). Hope you got the information. thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention |
![]() |
| Thread Tools | |
| Display Modes | |
| |