小编gob*_*ien的帖子

使用稍后声明的 C 结构体

我想使用尚未定义的 typedef 结构,但它是稍后定义的。有没有类似结构体原型的东西?

文件容器.h

// i would place a sort of struct prototype here
typedef struct 
{
 TheType * the_type;
} Container;
Run Code Online (Sandbox Code Playgroud)

文件 thetype.h

typedef struct {......} TheType;
Run Code Online (Sandbox Code Playgroud)

文件main.c

#include "container.h"
#include "thetype.h"
...
Run Code Online (Sandbox Code Playgroud)

c coding-style typedef forward-declaration

3
推荐指数
2
解决办法
2906
查看次数

标签 统计

c ×1

coding-style ×1

forward-declaration ×1

typedef ×1