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
What is multidimensional arrays
What's the total generic pointer type?
What is an expression?
What is a pointer on a pointer in c programming language?
What is the size of a union variable?
How do I determine whether a character is numeric, alphabetic, and so on?
Is c object oriented?
What is nested structure?
Write a program in c to replace any vowel in a string with z?
What are the scope of static variables?
Distinguish between actual and formal arguments.
Why is structure padding done in c?
What is the difference between functions abs() and fabs()?
write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.
The difference between printf and fprintf is ?