I'm learning the basic knowledge of c programming language. And now I am confused at pointer sections. There is the original question in the book:
Array a has some value and pointer p is now at a[1]:
a[0]:10
a[1]:20 <---p
a[2]:30
a[3]:40
a[4]:50
Question List:
- What's the value of
*p
after executes* p++
? - What's the value of
* ++p
? - What's the value of
++ * p
?
So, What's the different between *p++
, * ++p
, ++*p
?
In my opinion:
*p++
means to move pointerp
points the next element, so the 1st answer is 30.- The difference of
*p++
and*++p
just like the difference ofi++
and++i
. so the 2nd answer is 30. *p
means the value of pointer p, so++*p
means to letp
value increase 1. So the 3rd answer is 21;
Am i right?