sizeof an object | SoloLearn: Learn to code for FREE!


sizeof an object

class A {} int main { A a; cout << sizeof(a); // outputs 1 Why is this the case? Are we evaluating the object name as a char?

7/26/2020 7:13:25 AM


2 Answers

New Answer


Each object is given different address. So to distinguish different objects, size of each empty class object is 1 byte i.e. minimum memory allotted as per C++ standards. Some useful answers, you can get here: