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 |
Why is standard template library used?
Can a program run without main?
int *p = NULL; printf("%1d",p) ; what will be the output of this above code?
Difference between declaration and definition of a variable.
Hi i need to Acess a variable "int Intval" in the below mentioned code .How to Access it guys i am waiting for your reply
What are the advantages of early binding?
Explain about templates of C++.
On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?
What is a far pointer? where we use it?
What number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)? a) 6 b) 38 c) An unlimited number
What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)
What are the important differences between c++ and java?