Meaning of (++*ptr) in C Programming :
Consider the Following Example : -
int n = 20 , *ptr ;
ptr = &n;
printf("%d",++*ptr);Explanation :
- ‘++’ and ‘*’ both have Equal Precedence
- Associativity is from Right to Left ( Expression evaluated from R->L)
- Both are Unary (Operates on single operand )
- So ‘ * ‘ is Performed First then ‘ ++ ‘

Calculation of Answer :
++*ptr = ++ ( *ptr )
= ++ ( *3058 )
= ++ ( 20 )
= 21- Suppose ptr variable stores address 3058.
- * Operator will de-reference pointer to get value stored at that address. (i.e 20)
- Pre-increment on 20 will perform increment first then assignment
Live Example :
#include<stdio.h> int main() { int n = 20 , *ptr ; ptr = &n; printf("%d",++*ptr); return(0); }
Output :
21

