/*
* sizeofVariable.c
* Author : karthikeyan.D
* Date: 1-Nov-2010
*
*/
/* please refer this following statements.
#ifndef __SIZE_T
#define __SIZE_T
typedef unsigned int size_t;
#endif
.... meaning that on this particular implementation `size_t' is
an `unsigned int'.
*/
# include <stdio.h>
# include <stdlib.h>
//user definition
# define size_var( var ) ((size_t)(&(var)+1)-(size_t)(&(var)))
int main()
{
int nVal;
char cChar;
printf("size of :%d\n",size_var(nVal));
printf("size of :%d",size_var(cChar));
return 0;
}
No comments:
Post a Comment