View Single Post
  #4   Spotlight this post!  
Unread 05-01-2010, 18:19
TDohse TDohse is offline
Registered User
AKA: Thomas
no team (NI)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 39
TDohse is an unknown quantity at this point
Re: Kind of off topic c programming question.

Quote:
Originally Posted by daltore View Post
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));