I am working with C and I\'m a bit rusty. I am aware that *
has three uses:
C and C++ allows the use of pointers that point to pointers (say that five times fast). Take a look at the following code:
char a;
char *b;
char **c;
a = 'Z';
b = &a; // read as "address of a"
c = &b; // read as "address of b"
The variable a
holds a character. The variable b
points to a location in memory that contains a character. The variable c
points to a location in memory that contains a pointer that points to a location in memory that contains a character.
Suppose that the variable a
stores its data at address 1000 (BEWARE: example memory locations are totally made up). Suppose that the variable b
stores its data at address 2000, and that the variable c
stores its data at address 3000. Given all of this, we have the following memory layout:
MEMORY LOCATION 1000 (variable a): 'Z'
MEMORY LOCATION 2000 (variable b): 1000 <--- points to memory location 1000
MEMORY LOCATION 3000 (variable c): 2000 <--- points to memory location 2000