现在的位置: 首页 > 综合 > 正文

线性表–链表

2013年02月03日 ⁄ 综合 ⁄ 共 372字 ⁄ 字号 评论关闭

struct Node
{
char name[10];
int score;
struct Node*next;
};
typedef struct Node ListNode;

ListNode*CreatList(int n)//n表示链表中节点个数
{
ListNode*head;
ListNode*p,*pre;
int i;
head=(ListNode*)malloc(sizeof(ListNode));
head->next=NULL;
pre=head;
for(i=1;i
{
p=(ListNode*)malloc(sizeof(ListNode));
printf('',i);
scanf('',&p->name);
printf('',i);
scanf('',&p->score);
pre->next=p;
pre=p;
}
p->next=NULL;
return head;
}

抱歉!评论已关闭.