#include <stdio.h>
struct Example {
int a; // 4 bytes
char b[32]; // 32 bytes
double c; // 8 bytes
};
int main() {
struct Example ex;
printf("Size of struct Example: %lu bytes\n", sizeof(ex));
return 0;
}
运行结果为:Size of struct Example: 48 bytes
。
所以,正确答案是结构体Example
的大小为48字节。非常抱歉之前给您带来的困惑。