write a program for size of a data type without using
sizeof() operator?
Answer Posted / sunil
This has been solved in parts. I am not sure if there are
any better method merging it.
case 1. User passes a variable as the parameter.
eg: int n;
sizeof(n);
case 2. User passes a data type as the parameter.
eg: sizeof(int)
Solution
case 1: #define GetSize(x) (char*)(&x + 1) - (char*)&x
case 2:#define GetMySize(x) (char*)((x*)10 + 1) - (char*)10
Is This Answer Correct ? | 15 Yes | 6 No |
Post New Answer View All Answers
the question is that what you have been doing all these periods (one year gap)
What is new line escape sequence?
What is nested structure in c?
What was noalias and what ever happened to it?
What do header files do?
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
What are the benefits of c language?
what value is returned to operating system after program execution?
When can you use a pointer with a function?
What's the best way of making my program efficient?
Is null valid for pointers to functions?
How to throw some light on the b tree?
What is the use of clrscr?
What is the difference between union and structure in c?
What is scope of variable in c?