In C/C++, precedence of Prefix ++ (or Prefix –) and dereference (*) operators is same, and precedence of Postfix ++ (or Postfix –) is higher than both Prefix ++ and *.
If p is a pointer then *p++ is equivalent to *(p++) and ++*p is equivalent to ++(*p) (both Prefix ++ and * are right associative).
For example, program 1 prints ‘h’ and program 2 prints ‘e’.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Modulus on Negative Numbers
- Difference between ++*p, *p++ and *++p
- Increment (Decrement) operators require L-value Expression
- C/C++ Ternary Operator – Some Interesting Observations
- Pre-increment (or pre-decrement) in C++
- Program to Find the Largest Number using Ternary Operator
- Passing Reference to a Pointer in C++
- How to avoid Structure Padding in C?
- wcrtomb() function in C/C++
- vswprintf() function in C/C++