fork download
  1. #include<cstdio>
  2. #include<iostream>
  3. using namespace std;
  4. class Test
  5. {
  6. int arr[0];//why size is zero?
  7. };
  8.  
  9. int main()
  10. {
  11. Test a,b;
  12. cout <<"size of class"<<sizeof(a)<<endl;
  13. if (&a == &b)// now how we ensure about address of objects ?
  14. cout << "impossible " << endl;
  15. else
  16. cout << "Fine " << endl;//why address is nt same?
  17. return 0;
  18. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
size of class0
Fine