The struct is aligned according to the longest data type, and the memory occupied is an integer multiple of the largest member data type occupied by the struct. Pointers of various data types occupy 4 bytes of memory. Example:
# Include <iostream> using namespace STD; typedef struct t {bool a; int B; bool C; struct T * Next ;}; struct T1 {bool a; short B; bool C ;}; struct T2 {bool a; char B; bool C ;}; int main () {cout <"sizeof (t)" <sizeof (t) <Endl <"sizeof (T1)" <sizeof (T1) <Endl <"sizeof (T2)" <sizeof (T2) <Endl; cout <"int" <sizeof (INT) <Endl <"bool" <sizeof (bool) <Endl <"short" <sizeof (short) <Endl <"char" <size Of (char) <Endl; struct T * tttt; cout <"tttt" <sizeof (tttt) <Endl; char ** A [3] [4]; cout <"sizeof (a)" <sizeof (a) <"sizeof (& A)" <sizeof (& A) <Endl; // & A is 4 double * P; cout <"sizeof (* Double)" <sizeof (p) <Endl; // The size is 4 int * q; cout <"sizeof (* INT)" <sizeof (q) <Endl; // The size is 4 char * s; cout <"sizeof (* char) "<sizeof (s) <Endl; char B [10]; cout <" sizeof (B) "<sizeof (B) <Endl; char * C [10]; cout <"sizeof (C) "<Sizeof (c) <" sizeof (* C) "<sizeof (* C) <" sizeof (& C) "<sizeof (& C) <Endl; int X; int * r = & X; int ** RR = & R; cout <"sizeof (RR)" <sizeof (RR) <Endl; // The value is 4. RR is a second-level pointer, which is a pointer to a pointer. In essence, it is a pointer. System ("pause ");}