Can U write a C-program to print the size of a data type
without using the sizeof() operator? Explain how it works
inside ?

Answer Posted / saikat

#include <stdio.h>

int main()
{
float a[2];

int size = (char*)&a[1] - (char*)&a[0];

printf("%d
",size);
return 0;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to build a exercise findig min number of e heap with list imlemented?

1599


c language interview questions & answer

1447


How can I read a binary data file properly?

623


Why do we use header files in c?

569


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

587






How can I send mail from within a c program?

569


Explain the array representation of a binary tree in C.

713


Is main is user defined function?

583


to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?

1558


When can a far pointer be used?

578


Can you subtract pointers from each other? Why would you?

548


Which control loop is recommended if you have to execute set of statements for fixed number of times?

801


What is assignment operator?

617


What are the similarities between c and c++?

588


What is the difference between volatile and const volatile?

554