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.
- Operator Precedence and Associativity in C
- match_results prefix() and suffix() in C++
- Difference between Virtual function and Pure virtual function in C++
- cin get() in C++ with Examples
- Difference between Increment and Decrement Operators
- Map of Vectors in C++ STL with Examples
- Problem in comparing Floating point numbers and how to compare them correctly?
- exit(0) vs exit(1) in C/C++ with Examples
- Predefined Macros in C with Examples
- How to create GUI in C programming using GTK Toolkit
- C++ program to print all Even and Odd numbers from 1 to N
- Reverse the content of a file and store it in another
- ctype.h(<cctype>) library in C/C++ with Examples
- Minimum cells to be flipped to get a 2*2 submatrix with equal elements
Improved By : sourabh571993