c - 结构 tm 的大小

标签 c linux sizeof ctime

我在 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/

相关文章:

复制指针数组并打印副本

linux - 如何使用 Linux 变量作为命令参数

c - 为什么我在这里遇到段错误?

c - 是否有 "lseek"要内存?

c++ - 任何在 64 位机器上使用 8 个字节作为 int 数据类型大小的 C/C++ 编译器

c++ - 在一维数组中填充二维数组

c - 内存泄漏C-Valgrind

python - 'io.h' : No such file or directory during "pip install netifaces"

c++ - 模板函数 'know' 如何作为模板参数给出的数组大小?

c - while 循环没有中断