Quote:
Originally Posted by daltore
Pointers are basically variables that don't take up any space. They don't store data, they store a memory address that points to something that does store data. So if I had an unsigned character variable Var, and it had a value of 123, I could make a pointer Pnt of the same type (unsigned char), that wouldn't take up the full 8 bits of memory space, but would instead redirect the computer to read from wherever Var is stored.
|
Actually, pointers take up memory space just like any other variable. The size will vary depending on the architecture you're on. A pointer to a char might take 32 or 64 bits on a modern desktop system.
If you're curious, run this code:
Code:
char *fooPtr;
printf("fooPtr is %i bytes\n", sizeof(fooPtr));