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

Define macros.

111


what is reason of your company position's in india no. 1.

1258


what is the difference between 123 and 0123 in c?

129


What is the use of extern in c?

82


main() { static char *s[]={"black","white","yellow","voilet"}; char **ptr[]={s+3,s+2,s+1,s}, ***p; p=ptr; **++p; printf("%s",*--*++p+3); }

1083






What is a program flowchart?

81


What is static identifier?

118


Explain about block scope in c?

104


What is operator precedence?

99


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

89


What is a example of a variable?

64


What is quick sort in c?

41


How many bytes are occupied by near, far and huge pointers (dos)?

86


Is this program statement valid? INT = 10.50;

109


why return type of main is not necessary in linux

1174