Whenever you declare a pointer type does the compiler set aside only enough memory for that type? Or does it still use 4 bytes?
Or is that the whole point behind needing to declare a pointer type; to set aside enough memory?
Whenever you declare a pointer type does the compiler set aside only enough memory for that type? Or does it still use 4 bytes?
Or is that the whole point behind needing to declare a pointer type; to set aside enough memory?
>>Or does it still use 4 bytes?
It doesn't have to be 4 bytes, the compiler sets aside enough memory for a single pointer of type T, or
sizeof(T *)
*Cela*
A pointer is always going to point to a memory location. The memory location size is fixed for a given machine ( 4 bytes on 32-bit machines ). But if you just had void *'s everywhere and you wanted to do pointer arithmetic how would the compiler know how much to increment the memory address? So if you have an int * and you increment the pointer by 1 it will jump ahead 4 bytes ( the size of 1 int ). Hope this helps you a little bit.
I think I had a brain fart. I had forgot that all a pointer does is point to a memory address. LOL. Thanks.