why the size of an empty class is 1

Answer Posted / hitesh sojitra

When you calculate the size of a empty class that time you can c it takes 1 byte.which is the size of a char which a compiler takes for storing the address of a empty class.

The size of an empty class would depend on what is the range specified for the compiler for char. It takes that much space to store the address of a class.

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between the parameter to a template and the parameter to a function?

626


Differentiate between the message and method in c++?

602


What are the various arithmetic operators in c++?

569


What does ios :: app do in c++?

549


How does atoi function work?

618






Describe the setting up of my member functions to avoid overriding by the derived class?

605


Write a struct time where integer m, h, s are its members?

513


Do you know the use of vtable?

629


Why c++ is the best language?

590


What is null and void pointer?

587


Implement stack operations with pointers with appropriate exception checks.

562


How do you flush std cout?

560


How do you define a class in c++?

639


Why is c++ a mid-level programming language?

589


If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?

996