I'm taking CS50 via edx. One of the videos dealing with pointers (can't find it now) runs a program called noswap (under GDB) that highlights how C uses copies of variables (in this case, int a and int b) rather than the variables themselves (in this case, int x and int y).

Toward the end, the video runs "print &a" and receives something like "0xbfffefe4" as the memory location of "int a."

If "a" were a pointer to an int, how would one get the address to which "a" points as opposed to the address at which "a" resides?

Thanks in advance for any help.

  • Thanks very much for the comments. Mar 8, 2015 at 22:07
  • Kareem--Your diagram illustrates very concisely and clearly exactly what pointer notation means. Mar 8, 2015 at 22:10

3 Answers 3


If a is a variable of a pointer type, then &a returns a pointer to that variable (i.e., a pointer to a pointer) and *a returns the value that this variable points to (aka dereferences the pointer). Here's a visual representation of this relation:

++++     ++++     ++++
|  | ==> |  | ==> |  |
++++     ++++     ++++
 &a        a       *a

*a is how you deference a pointer, ie. go to it's address to see what it contains.


printf("%p", &*a);

returns the memory address of the location to which *a points.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .