#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define LEN sizeof(struct progress)
struct progress{
char name[20];
int prior;
int alltime;
int runtime;
int state;
struct progress *next;
};
int n;
struct progress *create(viod) //创建模块
{
n=0;
struct progress * head;
struct progress * p1,* p2;
p1=p2=(struct progress*)malloc(LEN);
scanf("%s %d %d %d %d",&p1->name,&p1->prior,&p1->alltime,&p1->runtime,&p1->state);
while(!strcmp(p1->name,""))
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct progress*)malloc(LEN);
scanf("%s %d %d %d %d,&p1->name",&p1->prior,&p1->alltime,&p1->runtime,&p1->state);
}
p2->next=NULL;
return head;
}
int mian();
{
struct progress *pt;
pt=creat();
printf("%s %d %d %d %d",p1->name,p1->prior,p1->alltime,p1->runtime,p1->state);
return 0;
}
为什么结构体定义指针显示编译错误?
#include<stdlib.h>
#include<string.h>
#define LEN sizeof(struct progress)
struct progress{
char name[20];
int prior;
int alltime;
int runtime;
int state;
struct progress *next;
};
int n;
struct progress *create(viod) //创建模块
{
n=0;
struct progress * head;
struct progress * p1,* p2;
p1=p2=(struct progress*)malloc(LEN);
scanf("%s %d %d %d %d",&p1->name,&p1->prior,&p1->alltime,&p1->runtime,&p1->state);
while(!strcmp(p1->name,""))
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct progress*)malloc(LEN);
scanf("%s %d %d %d %d,&p1->name",&p1->prior,&p1->alltime,&p1->runtime,&p1->state);
}
p2->next=NULL;
return head;
}
int mian();
{
struct progress *pt;
pt=creat();
printf("%s %d %d %d %d",p1->name,p1->prior,p1->alltime,p1->runtime,p1->state);
return 0;
}
为什么结构体定义指针显示编译错误?