刚刚学习单链表,自己试着写了一个跟书上有点不同,求指出有什么缺点
程序代码:#include <iostream>
using namespace std;
typedef struct link
{
int data;
link *next;
}llist;
llist *head()
{
llist *r,*s,*head;
head = new link;
r = new link;
s = new link;
int x;
head->next = r;
cout << "please input something:";
cin >> x;
while(x!=0)
{
r->data = x;
r->next = s;
r=s;
}
r->next = NULL ;
return head;
}[ 本帖最后由 Onesaber 于 2013-9-29 23:38 编辑 ]









