求大神 帮忙看一下这个链表 错误没有就是有个变量说得初始化 我实在是改不了了
#include<stdio.h>#include<stdlib.h>
#include<malloc.h>
typedef int datatype;
typedef struct node
{ datatype data;
struct node *next;
int last;
}linklist;
linklist *creattaillist()
{ linklist *l=(linklist *)malloc(sizeof(linklist));
linklist *s,*r=l;
int x;
scanf("%d",&x);
while(x!=-1)
{
s->data=x;
r->next=s;
r=s;
scanf("%d",&x);
}
r->next=NULL;
return l;
}
void output(linklist *l)
{
linklist *p;
p=l->next;
while(p!=NULL)
{ printf("%d",p->data);}
}
int lengthlist (linklist *l)
{ linklist *n=l->next;
int j=0;
while(n)
{n=n->next;j++;}
return j;
}
void main ()
{ linklist *l=creattaillist( );
output( l);
lengthlist (l);
}
D:\Microsoft Visual Studio\MyProjects\lbz\qlb.cpp(17) : warning C4700: local variable 's' used without having been initialized