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 are pointers declared in c?

592


What does sizeof function do?

608


what is stack , heap ,code segment,and data segment

2211


How can you check to see whether a symbol is defined?

585


Explain what are the advantages and disadvantages of a heap?

595






What functions are used in dynamic memory allocation in c?

591


Can we change the value of static variable in c?

556


Explain how can I convert a number to a string?

638


Why c is known as a mother language?

636


Who invented bcpl language?

698


Is malloc memset faster than calloc?

607


Why are algorithms important in c program?

614


Differentiate between static and dynamic modeling.

613


Define Array of pointers.

631


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?

1909