struct ptr
{
int a;
char b;
int *p;
}abc;
what is d sizeof structure without using "sizeof" operator??

Answer Posted / gagandeep

The total size would be 5.
Since 'int a' takes 2;
'char b' takes 1; and
'int *p' takes 2 (Note: Any pointer variable would take 2 bytes)

There is no additional size of 'struct' data structure.
Hence 5 is the value.

Is This Answer Correct ?    12 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can 'this' pointer by used in the constructor?

815


What is the difference between array_name and &array_name?

985


What is a nested formula?

791


What is a node in c?

732


What is the best way to store flag values in a program?

780


What the advantages of using Unions?

916


What do you mean by c?

783


Write a code of a general series where the next element is the sum of last k terms.

805


How is null defined in c?

860


What is the sizeof () operator?

788


Explain what are preprocessor directives?

817


Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)

6264


What are file streams?

772


Why header files are used?

837


What are the 4 types of functions?

789