我在 C 中使用 sizeof() 运算符打印了 sizeof(struct tm) 它给了我 44 个字节。但是在 ctime 的手册页中它有 9 个 int 时间变量。那么它的大小应该是 36。它是如何给出 44 的?
最佳答案
http://linux.die.net/man/3/ctime
The glibc version of struct tm has additional fields
long tm_gmtoff; /* Seconds east of UTC */ const char *tm_zone; /* Timezone abbreviation */
这就是额外字节的来源(可能)。
关于c - 结构 tm 的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13969210/