线性表--链表

来源:互联网 发布:房屋装修设计图软件 编辑:程序博客网 时间:2024/05/21 10:47
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;}




原创粉丝点击