69,374
社区成员
发帖
与我相关
我的任务
分享
struct test
{
int i;
int j;
};
//上面四行加起来才是一个完整的声明!!……
// 文件a.h
struct Point {
int x;
int y;
};
// 这也不是变量定义啊,为什么不能写到.h中?
/*a.h*/
struct test
{
int i;
int j;
};
//上面四行加起来才是一个完整的声明!!……
extern struct test myt;/*声明一个变量struct test类型的变量,变量名字叫myt*/
/*a.c*/
#include "a.h"
struct test myt;/*变量myt的真正定义*/
/*main.c*/
#include "a.h"
int main()
{
myt.i=0;/*访问变量myt*/
return 0;
}