C,C++,SQL,PL/SQL Search Engine

Custom Search

Java, ebook Search Engine

Custom Search

Saturday

1. Between the int pointer and long double pointer which pointer will consume more memory space?

Answer: 
Size of any type of pointer is independent of the data type which is it is pointing i.e. size of pointer is always fixed.  Size of any type (near) of pointer in c is two byte.  For example:
#include<stdio.h>
void main(){
    int *p1;
    long double *p2;
    printf("%d   %d",sizeof(p1),sizeof(p2));
}
Output: 2   2
Since both pointers int and long double are pointing to only first byte of int data and long double data respectively.








Hence both int pointer and long double pointer stores only address in 16 bits. Thus both of them will occupy exactly equal memory space. 

What is the size of void pointer in c?

Answer:
Size of any type of pointer in c is independent of data type which is pointer is pointing i.e. size of all type of pointer (near) in c is two byte either it is char pointer, double pointer, function pointer or null pointer.  Void pointer is not exception of this rule and size of void pointer is also two byte.

My Blog List