C++之数据结构,单链表
时间:2014-11-04 22:27:31
收藏:0
阅读:197
用结构体构建单链表例子:

int main ()
{
struct student head;
struct student body;
struct student end;
struct student *p;
head.a = 10;
head.b = 20;
body.a = 30;
body.b = 40;
end.a = 50;
end.b = 60;
head.next = &body;
body.next = &end;
end.next = NULL;
p = &head;
do{
cout<<p->a<<p->b<<"\n";
p = p->next;
}while(p != NULL);
}
评论(0)