当前位置:网站首页>A summary of global variables and typedef

A summary of global variables and typedef

2022-06-13 01:17:00 NI3E

Want to use global variables , An error is reported when the following structure is used :

///A.h
typedef struct student
{
	char *name;
	struct student*next;
}STUDENT;
///B.c
TOM=(STUDENT*)malloc(sizeof(STUDENT));

And then put typedef Remove all , Then change it to :

struct student
{
	char *name;
	struct student*next;
}STUDENT;

TOM=(struct student*)malloc(sizeof(struct student));

It will be normal , do not know why .

原网站

版权声明
本文为[NI3E]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280553489573.html