Wednesday, February 27, 2013

How could you find the size of a variable with out using sizeof operator?


#include <stdio.h>

#define SIZEOF(var)  ((size_t)(&(var)+1) - (size_t)(&(var)))

main( )
{
int x;
printf ("The size of x is %d\n", SIZEOF(x) );
}

No comments :