C size of void pointer
What is the size of Void Pointer variable in C ?
Pointer :
Pointer is the variable that stores the address of another variable .
How to calculate size of Pointer ?
- Size of Void Pointer can be evaluated by using sizeof operator
- Pointer stores the address of the Variable .
- Address of variable is nothing but the integer value .
- In C , for storing integer value 2 bytes are required .
- So void Pointer variable requires 2 bytes of memory.
int main(void)
{
int num = 0;
void *ptr;
num = 15;
ptr = #
/* Output the size */
printf("Size of Pointer : %d Bytes",sizeof(pointer));
return 0;
}
Output :
Size of Pointer : 2 Bytes
