Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

C++ | Class and Object | Question 2

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Predict the output of following C++ program




#include<iostream>
using namespace std;
   
class Empty {};
   
int main()
{
  cout << sizeof(Empty);
  return 0;
}

(A) A non-zero value
(B) 0
(C) Compiler Error
(D) Runtime Error


Answer: (A)

Explanation: See Why is the size of an empty class not zero in C++

Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads