建立 wiki 网站,山东住房和建设厅网站,中国电商排名,不需要网站备案的空间如果想在a.c中定义一个可以在b.c中可以使用的结构体变量#xff0c;则可以参照一下方法#xff1a;
首先在a.h中定义结构体和声明结构体变量#xff0c;如#xff1a;
typedef struct struct_a
{
//结构体内容
}
struct_a;extern struct_a aaa;
然后在a.c中定义结构体变…如果想在a.c中定义一个可以在b.c中可以使用的结构体变量则可以参照一下方法
首先在a.h中定义结构体和声明结构体变量如
typedef struct struct_a
{
//结构体内容
}
struct_a;extern struct_a aaa;
然后在a.c中定义结构体变量如下
#include a.hstruct_a aaa;
这样只要在b.c中#include a.h就可以在b文件中调用和使用结构体变量aaa了