How much is size of struct having 1 char & 1 integer?

Answer Posted / raja

you will have to study through structure padding concepts.
It depends on the compiler.
struct
{
char a;
int b;
}
The above struct size will be 8 in standard compilers (Turbo
C is a non-standard compiler). bcoz between a and b there
will be 3 pad bytes placed..

Refer this link you will know everything about structure
padding..All d best :)
http://www.allinterview.com/showanswers/62991.html

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is standard template library used?

824


Can you use the function fprintf() to display the output on the screen?

982


What does it mean to declare a member function as virtual?

838


Write about the members that a derived class can add?

789


Can a constructor return a value?

934


What is a list c++?

877


What is an operator function? Describe the function of an operator function?

881


What does override mean in c++?

802


what is VOID?

850


Why is polymorphism useful?

823


How many static variables are created if you put one static member into a template class definition?

793


Why was c++ created?

815


Discussion on error handling of C++ .

882


Can we use struct in c++?

799


Why is c++ still popular?

821