[Solved] pointer: *p and &p in C programming language [duplicate]


Just take

int a =10;
int *p = &a;

a is a variable which holds value 10. The address in which this value is stored is given by &a.

Now we have a pointer p , basically pointer points to some memory location and in this case it is pointing to memory location &a .

*p gives you 10

This is called dereferencing a pointer.

p = &a /* Gives address of variable a */

Now let’s consider

&p

Pointer is a also a data-type and the location in which p is stored is given by &p

solved pointer: *p and &p in C programming language [duplicate]