Monday, April 26, 2010


why n++ executes faster than n+1?

The expression n++ requires a single machine instruction such as "INR" to carry out the increment operation whereas, n+1 requires more instructions to carry out this operation.


This comment has been removed by the author.

n++ is unary operation and n+1 is binary operation.unary operation takes less time than binary operation.that is why n++ is faster than n+1

It's totally Machine dependent or compiler dependent.

Post a Comment