In C/C++, precedence of Prefix ++ (or Prefix –) has higher priority than dereference (*) operator, 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.
- Interesting facts about Operator Precedence and Associativity in C
- match_results prefix() and suffix() in C++
- How to create an unordered_map of pairs in C++?
- Full screen OpenCV / GtK application in C++ running on Raspberry PI
- C++, OpenCV and Gtk3 Windows dev environment
- How to create an unordered_map of user defined class in C++?
- Sum of Bitwise-OR of all subarrays of a given Array | Set 2
- attributes in C++
- Find sum of a number and its maximum prime factor
- How to traverse a C++ set in reverse direction
- How to Read and Print an Integer value in C++
- How to Read and Print an Integer value in C
- Difference between Definition and Declaration
- Nested switch case
Improved By : sourabh571993