why the size of an empty class is 1

Answers were Sorted based on User's Feedback



why the size of an empty class is 1..

Answer / 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

why the size of an empty class is 1..

Answer / abhishek

its because an empty class makes an entry to symbol table (code segment)
which requires a symoblic mapping of 1 byte

Is This Answer Correct ?    9 Yes 4 No

why the size of an empty class is 1..

Answer / kamna

it is becuse each oject must have a different address.

Is This Answer Correct ?    10 Yes 5 No

why the size of an empty class is 1..

Answer / surender a

Because the fundamental size is a char [viz 1 byte by
default on any 32 bit or 64 bit machine].

Is This Answer Correct ?    5 Yes 7 No

Post New Answer

More C++ General Interview Questions

What is meaning of in c++?

0 Answers  


Are strings mutable in c++?

0 Answers  


Write a program that will count the number of digits in an input integer up to value MAX_VALUE (2147483647). Thus, for an input of 5837 the output should be 4 digits Make sure that your program works for the numbers 0, 1, and 10. For the number 0, the output should be 1 digit

2 Answers  


What is the v-ptr?

0 Answers  


What causes a runtime error c++?

0 Answers  






How Virtual functions call up is maintained?

2 Answers  


Explain register storage specifier.

0 Answers  


How do you establish a has-a relationship?

0 Answers  


What language does google use?

0 Answers  


List different attributes in C++?

0 Answers   Ericsson,


Explain the problem with overriding functions

0 Answers  


What is difference c and c++?

1 Answers  


Categories