Monday, 25 April 2016

whether sizeof of two different pointers will vary in same machine?

The answers is yes.  But we may studied that the size of pointer is common for all int pointer,char pointer,double poiter.These are data pointers.

Sizeof data pointer will be different from function pointer

int main()


 int *a;// data pointer

 int (*my_function)(); // Function pointer

 printf(“%u is not equal to %u”, sizeof a,sizeof my_function);

 printf(“Disclaimer: This is purely Architecture dependent”);


Reason behind this info:
System will store the code and data in different memory. Eg : Havard Architecture