error C2275:'STU' :illegal use of this type as an expression see declarat问题处在哪里?代码如下,问题好像是insert()函数里面的STU定义问题,对这几个函数一个一个调试,第一个createlist()没问题(那些注释

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/15 00:13:12
error C2275:'STU' :illegal use of this type as an expression see declarat问题处在哪里?代码如下,问题好像是insert()函数里面的STU定义问题,对这几个函数一个一个调试,第一个createlist()没问题(那些注释

error C2275:'STU' :illegal use of this type as an expression see declarat问题处在哪里?代码如下,问题好像是insert()函数里面的STU定义问题,对这几个函数一个一个调试,第一个createlist()没问题(那些注释
error C2275:'STU' :illegal use of this type as an expression see declarat问题处在哪里?
代码如下,问题好像是insert()函数里面的STU定义问题,对这几个函数一个一个调试,第一个createlist()没问题(那些注释你懂得,我就不多解释了),
#include
#include
typedef struct student
{
\x05int num;
\x05char name[10];
\x05struct student *next;
}STU;
void createlist(STU *q)
{
\x05int i,n;
\x05STU *p;
\x05scanf("%d",&n);
\x05for(i=0;inext==NULL)
\x05\x05{
\x05\x05\x05scanf("%d %s",&p->num,p->name);
\x05\x05\x05q->next=p;
\x05\x05\x05q=p;
\x05\x05}
\x05\x05q->next=NULL;
\x05}
}
void insert(STU *p)
{
\x05int n;
\x05scanf("%d",&n);
\x05STU *q,*r;
\x05r=(STU *)malloc(sizeof(STU));
\x05while(p->num!=n)
\x05{
\x05\x05q=p;
\x05\x05p=p->next;
\x05}
\x05scanf("%d %s",&r->num,r->name);
\x05q->next=r;
\x05r->next=p;
}
/*
void findlist(STU *p)
{
\x05int n;
\x05scanf("%d",&n);
\x05while(p->num!=n)
\x05{
\x05\x05p=p->next;
\x05}
\x05printf("num:%d name:%s",p->num,p->name);
}
void printlist(STU *p)
{
\x05p=p->next;
\x05while(p->next!=NULL)
\x05{
\x05\x05printf("num:%d name:%s\n",p->num,p->name);
\x05\x05p=p->next;
\x05}
}
void dellist(STU *p)
{
\x05int n;
\x05STU *q;
\x05scanf("%d",n);
\x05while(p->num!=n)
\x05{
\x05\x05p=p->next;
\x05\x05q=p;
\x05}
\x05q->next=p->next;
\x05free(p);
}
*/
void main()
{
//\x05int n;
\x05STU head;
\x05head.next=NULL;
\x05createlist(&head);
\x05printf("OK1!\n");
\x05
\x05insert(&head);
\x05printf("OK2!\n");
/*\x05scanf("%d",n);
\x05switch(n)
\x05{
\x05case 1:createlist(&head);break;
\x05case 2:insert(&head);break;
\x05case 3:findlist(&head);break;
\x05case 4:printlist(&head);break;
\x05case 5:dellist(&head);break;
\x05case 0:exit();break;
\x05default:printf("输入错误!\n");
\x05}*/
}

error C2275:'STU' :illegal use of this type as an expression see declarat问题处在哪里?代码如下,问题好像是insert()函数里面的STU定义问题,对这几个函数一个一个调试,第一个createlist()没问题(那些注释
vc6.0编译通过……
没有问题

error C2275:

error C2275:

error C2275:

error C2275: