posted by Ray on .
how do the following statements differ
and what does int **a mean
1) p points to a
2) the address of a is stored where p is pointing
3) p points to memory address 1
4) prints the address stored in p
5) prints the integer pointed to by p
Hello Ray :)
(Sorry if i have a bad English)
- int a = 1 : You declared an integer variable, (imagine that is a box that contain the value 1 : .
-int *p : You declared a pointer of integer . When we declare a pointer we need to put * before the variable . But * have an other meaning, when we use the pointers :
Imgine that p is an arrow that indicate integer boxes ->[int ?]. p will contain the address of the box, and *p allows us to see what's in the box .
1] Imagine that we give to "p" the address of "a", than the pointer p "->" will move and stuck to the box "a" like this : ->[ 1] "
2]we put into the box that was pointed by "p ->[?int]" the location of a . ( useless :) )
3] p will point to another memory slot, and we give to him an other box  (in these case it will change nothing :) : p will point the same box "a" )
And like Steve said :
4] prints the address stored in p
5] prints the integer pointed to by p