void Createlist(linklist (*& L),elemtype a[],int n) //jianli shunxu lianbiao {linklist *s,*r;int i;void Createlist(linklist (*& L),elemtype a[],int n) //jianli shunxu lianbiao{linklist *s,*r;int i;L=(linklist *)malloc(sizeof(linklist)) //chuangjianto
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/28 01:22:28
![void Createlist(linklist (*& L),elemtype a[],int n) //jianli shunxu lianbiao {linklist *s,*r;int i;void Createlist(linklist (*& L),elemtype a[],int n) //jianli shunxu lianbiao{linklist *s,*r;int i;L=(linklist *)malloc(sizeof(linklist)) //chuangjianto](/uploads/image/z/14273083-19-3.jpg?t=void+Createlist%28linklist+%28%2A%26+L%29%2Celemtype+a%5B%5D%2Cint+n%29+%2F%2Fjianli+shunxu+lianbiao+%7Blinklist+%2As%2C%2Ar%3Bint+i%3Bvoid+Createlist%28linklist+%28%2A%26+L%29%2Celemtype+a%5B%5D%2Cint+n%29+%2F%2Fjianli+shunxu+lianbiao%7Blinklist+%2As%2C%2Ar%3Bint+i%3BL%3D%28linklist+%2A%29malloc%28sizeof%28linklist%29%29+%2F%2Fchuangjianto)
void Createlist(linklist (*& L),elemtype a[],int n) //jianli shunxu lianbiao {linklist *s,*r;int i;void Createlist(linklist (*& L),elemtype a[],int n) //jianli shunxu lianbiao{linklist *s,*r;int i;L=(linklist *)malloc(sizeof(linklist)) //chuangjianto
void Createlist(linklist (*& L),elemtype a[],int n) //jianli shunxu lianbiao {linklist *s,*r;int i;
void Createlist(linklist (*& L),elemtype a[],int n) //jianli shunxu lianbiao
{linklist *s,*r;int i;
L=(linklist *)malloc(sizeof(linklist)) //chuangjiantoujiedian
r=L; //r zhixiang wei jiedian,kaishishi zhixiang toujiedian
for(i=0;idata=a[i]; //weichafa xiang lianbiao zhong charu shu yuanshu
r->next=s;
r=s;
}
r->next=Null;
}
错在哪,为什么调试不出来
void Createlist(linklist (*& L),elemtype a[],int n) //jianli shunxu lianbiao {linklist *s,*r;int i;void Createlist(linklist (*& L),elemtype a[],int n) //jianli shunxu lianbiao{linklist *s,*r;int i;L=(linklist *)malloc(sizeof(linklist)) //chuangjianto
void Createlist(linklist (*& L),elemtype a[],int n)
这明显就是一个建立链表的函数框架吗,你连linklist结构体都没定义,还有数组的数据类型这也是模板elemtype,这数据类型都没定义好,怎么可能编译通过呢.
函数体里链表建立过程到时没什么问题.
如果你定义好了,给这只是一部分麻烦都给出来才能帮你调试吗.