English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

how much space does a pointer(any type char or int) occupy?
for eg:
int *p;
char *q;
how much memory will p and q occupy?

2007-12-05 19:09:19 · 4 answers · asked by Karandeep Singh 3 in Computers & Internet Programming & Design

4 answers

x/8 bytes as they are holding addresses in an x-bit system, 16 bits for DOS, each took 2 bytes there.

2007-12-05 19:31:25 · answer #1 · answered by Andy T 7 · 0 0

pointers occupy memory regardless of whether they point to anything or not. How much memory they occupy depends on the nature of the object they
point to.

2007-12-05 19:14:53 · answer #2 · answered by Agni 2 · 0 0

a pointer always has 4 bytes on a 32bit system and 8 bytes on a 64bit system.

you can test it with this code:
printf("%d\n", sizeof(void *));

2007-12-05 19:37:25 · answer #3 · answered by cruppstahl 4 · 2 0

depends on the ram memory

2007-12-05 19:15:08 · answer #4 · answered by anand .P 1 · 0 1

fedest.com, questions and answers