C/C++的sizeof()函数 结构体 对于结构体,指的是结构体所占内存大小,需要注意结构体对齐。 #include <stdio.h> struct st{ int i; //4字节 char c; //1字节 }; int main() { printf("%d\n",sizeof(struct st)); return 0; }