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

void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply

2209


Why is c so powerful?

671


What is the purpose of main() function?

648


What is meant by inheritance?

622


Whats s or c mean?

587






What are Macros? What are its advantages and disadvantages?

632


Differentiate between functions getch() and getche().

613


What will the preprocessor do for a program?

578


In C language, a variable name cannot contain?

730


In C, What is the #line used for?

1039


How can I read in an object file and jump to locations in it?

567


What do you mean by c what are the main characteristics of c language?

562


What is pointer to pointer in c?

626


Are negative numbers true in c?

587


How many levels of indirection in pointers can you have in a single declaration?

587