[C语言] C语言结构体中的变量如何被结构体内函数调用?

[复制链接]
 楼主| ee168 发表于 2022-2-2 21:25 | 显示全部楼层

typedef struct _MY_DEMO{

    int x;

    int y;

    int (*add)(struct _MY_DEMO *dd);

}MY_DEMO;

编译能通过吗?11楼是正确的,传VOID指针过去
hello、C 发表于 2022-2-5 08:39 | 显示全部楼层
ayb_ice 发表于 2022-1-19 11:43
total = demo.add(demo.x,demo.x);

是呢,为什么不这样呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 在线客服 返回列表 返回顶部
快速回复 在线客服 返回列表 返回顶部