Friday, April 9, 2010

You are given a datatype, say X in C. The requirement is to get the size of the datatype, without declaring a variable or a pointer variable of that type, And, of course without using sizeof operator !

Sol:- #define size(type) ( (int)((type *)0+1) - (int)((type *)0)) 

No comments:

Post a Comment