I have following code :
#include <iostream>
using namespace std;
class A {
int a;
char* b;
};
class B {
int a;
};
class C {
char *b;
};
int main() {
// your code goes here
cout << "size of A:" << sizeof(A) << endl;
cout << "size of B:" << sizeof(B) << endl;
cout << "size of C:" << sizeof(C) << endl;
return 0;
}
link to ideone : https://ideone.com/OAQuMv
Size of A is 16
Size of B is 4
Size of C is 8
Why size of A is 16 not 12?