注册 登录
编程论坛 C语言论坛

关于offsetof应用报错

数据总线 发布于 2025-06-14 15:27, 1810 次点击
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
typedef    struct
{
    int a;
    unsigned char b;
    char    c;
}Mystruct;

int main(int argc, char *argv[])
{
    unsigned int    Address;
    Address = offsetof(Mystruct, b);
}
为什么会报 error: syntax error before ')' token  这个错误,一直都没有找到原因......
4 回复
#2
apull2025-06-15 10:56
测试运行没问题,你看看具体的报错行数。
只有本站会员才能查看附件,请 登录



#3
数据总线2025-06-16 08:11
回复 2楼 apull
你好,方把把整个源文件复制一份吗,我放进我的编译器里编译看看会不会报错..............
#4
apull2025-06-18 23:01
回复 3楼 数据总线
复制的你的源码,没修改,直接编译通过

#5
不会游泳的虾2025-06-19 10:15
上面的代码,试了下,没有问题啊。
1