当前位置: > 文件 DoubleList.h...
题目
文件 DoubleList.h
typedef struct DulNode{
int data;
struct DulNode *prior;
struct DulNode *next;
}DulNode;
文件 DoubleList.c
Head *InitLink(){
printf("请输入节点的值,0为结束标志:");
Head *p;
DulNode *q,*s;
int elem;
p = (struct Head *)malloc(sizeof(Head));
p->head = NULL;p->lenght = 0;
q=(DulNode*)malloc(sizeof(DulNode));
scanf("%d",&elem);
while(elem){
s =(DulNode*)malloc(sizeof(DulNode));
s->data = elem;
if(p->head == NULL){
p->head = s;
p->lenght+=1;
s->prior = s;
s->next = s;
q = s;
}
else{
q->next = s;
s->prior = q;
q->prior = s;
s->next = q;
p->lenght+=1;
}
scanf("%d",&elem);
}
free(q);
return p;
}
typedef struct Head{
int lenght;
struct DulNode *head;
}Head;
请问为什么会报 'Head' : illegal use of this type as an expression错误.哪位大侠能帮帮忙.小弟非常感激.

提问时间:2020-08-08

答案
lude "stdlib.h" /*加入这个头文件原因函数名称:malloc函数原型:void * malloc(unsigned size);函数功能:分配size字节的存储区函数返回:所分配的内存区地址,如果内存不够,返回0参数说明:所属文件:<stdlib.h>...
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.