What is the size of a void pointer ?

Showing Answers 1 - 1 of 1 Answers

vishnu

  • Jan 27th, 2007
 

All pointers are of the same size. The size of which depends on the machine - 64/32 bits

  Was this answer useful?  Yes

Ankit Bandyopadhyay

  • Feb 21st, 2007
 

Actually size of a pointer is fixed,it is 1word.Now 1 word is defined in dos as 2 bytes,but in windows it is 4 bytes.

Ashwan

  • Jul 26th, 2007
 


2 Bytes

  Was this answer useful?  Yes

The size of any pointer variable is same. ( 2 byte in case of 32 bit machine ).

The type of pointer defines the type of data the pointer is pointing to .

eg. if the pointer is definde as

int *p;

then it will create a pointer p ( of two bytes ) which is pointing to a data of type int ( again of 2 byte ) .

If we create

float *pf;

it will create a pointer ( again of 2 bytes ) but pointing to a float ( of 4 byte ).

The difference makes sense when we try to read or move to the next block etc.

suppose we created a char type pointer to an int then while reading, it will just read the first byte leaving the second byte of int thus giving us wrong output.

as_hmr

  • Mar 11th, 2008
 

Yes pointer size is always that of size of word on a particular architecture.

Actually pointer only contains starting address of a data type, there after how many bytes we have to read (e.g. 1 for char, 2 for int) depends upon type of pointer declared.

ilushka

  • Jul 29th, 2011
 

all pointers are the same size, they only differ on the platform and the amount memory you are trying to address. for example, on an 8051 platform it's 3 bytes, on an intel it's 32 or 64 bits wide.

jignesh

  • Dec 29th, 2012
 

Size of void pointer or size of character pointer are same because both variable contain address or we can say memory location

  Was this answer useful?  Yes

Niyas Ibrahim

  • Sep 2nd, 2013
 

Use of pointer is to store a memory address.since any location in the memory have same type(characters or digits) of memory address, size is same for all pointer types.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions