What is size of Empty Class?
Answers were Sorted based on User's Feedback
Answer / amit basak
The size of the class will be 1 byte as mentioned by Rahul...
Here is the below code in Cygwin ...
// This program is to find the size of empty class
#include<iostream>
using namespace std;
class Demo
{
};
int main ()
{
cout <<"Sizeof Demo class is ="<<sizeof(Demo)<<endl;
return(0);
}
And here is the output..
$ ./a.exe
Sizeof Demo class is =1
| Is This Answer Correct ? | 14 Yes | 1 No |
Answer / saket kale
when i tried to calculate the size of an empty class that
time i found that it takes 1 byte.which is the size of a
char.That might be the memory taken by the compiler for
storing the address of a empty class.
| Is This Answer Correct ? | 2 Yes | 0 No |
What are the advantages of using a pointer? Define the operators that can be used with a pointer.
Is turbo c++ free?
What is function prototyping?
what is the diff b/n c and c++ a. dynamic scoping b. nested switching c. declaration of variables in any code block d. separation of compilation and linking
Do you know about C++ 11 standard?
0 Answers Agilent, ZS Associates,
What is realloc() and free()? What is difference between them?
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
Live example for static function?
Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?
What is c++ redistributable?
Why null pointer is used?
Which bit wise operator is suitable for putting on a particular bit in a number?