我有以下C代码
文件名:abc.c
#include<stdio.h>
struct abc{
int xxx;
float yyy;
};
Run Code Online (Sandbox Code Playgroud)
我需要在另一个名为def.c的文件中访问上面的结构
任何人都可以解释我如何实现这一目标吗?
谢谢!
// mystructs.h
struct abc{
int xxx;
float yyy;
};
//abc.c
#include "mystructs.h"
struct abc var1;
//another_file.c
#include "mystructs.h"
struct abc var2;
Run Code Online (Sandbox Code Playgroud)