how to find the size of the data type like int,float
without using the sizeof operator?

Answer Posted / sunil

When the parameter is a datatype.
For Eg: sizeof(int), sizeof(double)
#define GetSize(x) (char*)((x*)10 + 1) - (char*)10


When the parameter is a variable.
For Eg: int a;
float b;
sizeof(a), sizeof(b)
#define GetSize(x) (char*)(&x + 1) - (char*)&x

Is This Answer Correct ?    10 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the meaning of 2d in c?

815


What is the difference between malloc calloc and realloc in c?

888


How many levels deep can include files be nested?

866


What is meant by errors and debugging?

853


Write a program for Overriding.

903


Can we declare a function inside a function in c?

804


Explain heap and queue.

795


Explain how do you convert strings to numbers in c?

817


Tell us bitwise shift operators?

797


Why does not c have an exponentiation operator?

803


How can I find out how much free space is available on disk?

817


What is a macro?

862


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

1955


Is c easier than java?

782


Is the exit() function same as the return statement? Explain.

849