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.
The question is meaningless since the two aren't equivalent.
n++ modifies n. n+1 does not.
If the purpose is to increment n by one and n is a register variable, the two are almost the same in processor resources, except that the result of n+1 requires the compiler to allocate a second register for the intermediate result.
Also, the first answer is incorrect. The 'INC EAX' instruction in an x86 CPU is no faster than an 'ADD EAX,1' instruction and the only benefit is to reduce code space.
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.
Well, it does not! While we might be tempted to say that 'increment' instruction executes faster than a 'sum' instruction, I have not come across any compiler which uses 'sum' instruction for 'k+1'. Also, this issue is totally dependent upon the instruction set of the machine (and compiler) for which the code is compiled. So, there is no point in making it a general rule.
hi.. n++ and n+=1 both will give the same results but when you compile these instructions seperately, compliler will generate only INR for n++ and for n += 1 will generate ADD instruction . So this INR instruction is run little smaller than ADD.