C:链表的操作(二),如何打印一个链表
来源:岁月联盟
时间:2012-02-02
废话不说,直接跟上以前的代码,写出打印函数来。
void print(struct student *head)
{
struct student *p;
printf(“/n these %d records are:/n”,n);
p = head;
if(head != NULL)
do
{
printf(“%ld %f/n”,p->num,p->score);
p = p->next;
}while(p != NULL);
}
很简单,效果跟上一篇一样,那个也是通过这个函数打印出来的,
请关注 李木空间