error C2275:'STU' :illegal use of this type as an expression see declarat问题处在哪里?代码如下,问题好像是insert()函数里面的STU定义问题,对这几个函数一个一个调试,第一个createlist()没问题(那些注释
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/21 09:22:30
![error C2275:'STU' :illegal use of this type as an expression see declarat问题处在哪里?代码如下,问题好像是insert()函数里面的STU定义问题,对这几个函数一个一个调试,第一个createlist()没问题(那些注释](/uploads/image/z/9642016-64-6.jpg?t=error+C2275%3A%27STU%27+%3Aillegal+use+of+this+type+as+an+expression+see+declarat%E9%97%AE%E9%A2%98%E5%A4%84%E5%9C%A8%E5%93%AA%E9%87%8C%3F%E4%BB%A3%E7%A0%81%E5%A6%82%E4%B8%8B%2C%E9%97%AE%E9%A2%98%E5%A5%BD%E5%83%8F%E6%98%AFinsert%EF%BC%88%EF%BC%89%E5%87%BD%E6%95%B0%E9%87%8C%E9%9D%A2%E7%9A%84STU%E5%AE%9A%E4%B9%89%E9%97%AE%E9%A2%98%2C%E5%AF%B9%E8%BF%99%E5%87%A0%E4%B8%AA%E5%87%BD%E6%95%B0%E4%B8%80%E4%B8%AA%E4%B8%80%E4%B8%AA%E8%B0%83%E8%AF%95%2C%E7%AC%AC%E4%B8%80%E4%B8%AAcreatelist%EF%BC%88%EF%BC%89%E6%B2%A1%E9%97%AE%E9%A2%98%EF%BC%88%E9%82%A3%E4%BA%9B%E6%B3%A8%E9%87%8A)
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: