
- Forum
- Programming Talk
- C and C++
- How is it Evaluated?
How is it Evaluated?
This is a discussion on How is it Evaluated? within the C and C++ forums, part of the Programming Talk category; I want to know how *p++ gets evaluated as p being declared as a integer pointer. If anyone could explain ...
-
How is it Evaluated?
I want to know how *p++ gets evaluated as p being declared as a integer pointer. If anyone could explain the above with an example it would help me a lot.
-
In C programming both indirection operator and ++ operator takes the same level of precedence and the associativity is from right to left. So ++ gets evaluated first which means the address of p gets incremented and then the contents is retrieved from that and assigned to the variable. That is if you have address that is value of p as 1000 and contents of 1000 as 5. Then *p++ gets evaluated as 1000 gets incremented. Since it is integer it is incremented by 4 bytes which gives 1004 and contents of 1004 are accessed. This is how *p++ works.
«
Pointer Problem
|
Program Fails
»

Reply With Quote





