C Puzzles

yet another place for C puzzles

Thursday, October 20, 2005

 

size without sizeof !!!

You are given have 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 !

Comments:
#define size_of(T) (((T*)0)+1)
 
I knew that you will answer this in a shot.
:-)
 
both are big cats
 
Post a Comment

Subscribe to Post Comments [Atom]





<< Home

Archives

July 2005   August 2005   October 2005   December 2005   March 2006   June 2006   July 2006   December 2006   February 2007   June 2007   March 2010   May 2010  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]