This is not about algorithms,but related to C programming.
How to implement sizeof operator?
macro for this
#define my_sizeof(a) (char*)(&a+1)-(char*)&a
this works fine of variables
int a;
printf("%d",my_sizeof(a)); //or even for user defined
structures
but it will not work for data types
like
printf("%d",my_sizeof(int));
so please get another solution.
function will be preferable.not macro
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.