how much memory a pointer takes

Thread Starter

aamirali

Joined Feb 2, 2012
412
1. how much memory a pointer takes, do it takes memory or it only points to address
2. Also when i declare
int *p
how much memory it takes
 
Last edited:

ErnieM

Joined Apr 24, 2011
8,377
Yes, it takes memory. Any variable you define takes memory.

How much memory depends on what compiler and what device you're using.
 

MrChips

Joined Oct 2, 2009
30,712
A pointer is storage for a memory address hence the size of the storage will depend on the memory model of the target computer.

For example, if the MCU has 64k memory space, it will require a 16-bit address.
Hence the pointer will be a 16-bit memory location.
 
Top