代码改变世界

calculate the size of the new type

2010-10-02 23:14  wansishuang  阅读(223)  评论(0编辑  收藏  举报

You are given have a datatype, say X in C. Determine the size of the datatype,without declaring a variable or a pointer variable of that type, and, of course without using
the sizeof operator!

 

#define sizeof_macro(type_t) ((unsigned)((type_t *)0 + 1))