I don't think p+1 is faster than p++. Internally P++ will be implemented as P+1 only. Although the ++P is faster than P++ as it avoids the temporary variable creation.
I don't think p+1 is faster than p++. Internally P++ will be implemented as P+1 only. Although the ++P is faster than P++ as it avoids the temporary variable creation.
p++ when the command p++ is given the compiler understands that value of p is incresed by one and wherever p is used (as in the expression u p/2) it(compiler) uses value p+1rather than p so if the code is int p; p++; float u p/2; then the lines compiler understands is int p; p++; float u (p+1)/2;
p p+1 when this statement is written then the compiler goes to the location where p is stored and increments the value by 1
p++ is faster because on compilation it gets translated to three machine instructions where as p p+1 needs four machine instructions. All machine instructions take the same time.