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

2006-10-15 21:24:52 · 4 answers · asked by Sourav 1 in Computers & Internet Programming & Design

4 answers

no ..the size of a char * and a int * or a void * can not be different..because basically both are storing a address only..
and according to ANSI C standards, sizeof(int) =size of the address bus on your machine/OS.
So with a 16 bit machine, size of * (int/char/..) =sizeof(int)=2 bytes.
So with a 32 bit machine, size of * (int/char/..) =sizeof(int)=4 bytes.
So with a 64 bit machine, size of * (int/char/..) =sizeof(int)=8 bytes.
and so on

2006-10-17 20:48:54 · answer #1 · answered by bingo! 2 · 0 0

In theory the size of a char* and a int* can be different. I never seen
it myself, and I don't think it's very common. The purpose of the void*
is to prevent this problem. You can always be shure that a void* will
fit into anything, and can take the value of any pointer.

2006-10-17 07:59:36 · answer #2 · answered by veerabhadrasarma m 7 · 0 0

I think it depends on the data type of the pointer. I have seen it practically and checked the size of the pointer varible in C.

2006-10-17 14:40:34 · answer #3 · answered by Mani_0007 1 · 0 0

For a normal pointer and short poiner, it is 4 bytes in C.
For long and huge pointers, it is 8 bytes. 4 bytes for the segment address and the other 4 bytes for offset address.

in normal and short pointers, the segment is assumed to be the current segment, so the 4 bytes are used up as offset address.

2006-10-16 04:32:02 · answer #4 · answered by Pandian 3 · 0 0

fedest.com, questions and answers