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 ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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.
|
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to find second max sal of employee with the co | chandraismoon | Oracle Tutorials | 7 | 05-16-2008 04:08 AM |