| 查看: 501 | 回复: 2 | ||
[求助]
C语言链表的建立,有几个地方看不懂,请大神指导 已有1人参与
|
|
#include <stdio.h> #include <stdlib.h> #include <malloc.h> #define NULL 0 struct stu{ long num; float score; struct stu *next; }; typedef struct stu Stu_link; Stu_link *cre_link(){ Stu_link *head=NULL,*last=NULL,*p; p=(Stu_link *)malloc(sizeof(Stu_link));//开辟节点 printf("input num:" ;scanf("%d",&(p->num)); printf("input score:" ;scanf("%d",&(p->score)); p->next=NULL; while(p->num){ if(head=NULL){ head=p; last=p; } else{ last->next=p; head=p; } p=(Stu_link *)malloc(sizeof(Stu_link));//开辟新节点 printf("input num:" ;scanf("%d",&(p->num)); if(p->num){ printf("input score:" ;scanf("%d",&(p->score)); p->next=NULL; } } return head; } int main() { cre_link(); system("pause" ;return 0; } 其中的如下语句: if(head=NULL){ head=p; last=p; } else{ last->next=p; head=p; } 请问这几句怎么理解? |
» 猜你喜欢
如果工作了想读博,可以边工作边读全日制嘛?
已经有6人回复
青B发送上会通知了吗
已经有9人回复
西安交大新媒学院副院长用撤稿论文结题
已经有6人回复
论文撤稿了
已经有8人回复
博士申请
已经有7人回复
化学专业申博
已经有4人回复
评审有感
已经有27人回复
河北省自然科学基金
已经有9人回复
某211大学教师把个人教师官方主页改成:我跑了我跑了我跑了!官宣跑路!
已经有5人回复
26/27申博自荐
已经有9人回复

duotojh
金虫 (小有名气)
- 应助: 9 (幼儿园)
- 金币: 1066.6
- 红花: 5
- 帖子: 225
- 在线: 137.8小时
- 虫号: 1290636
- 注册: 2011-05-09
- 专业: 生物物理、生物化学与分子
2楼2014-11-13 21:25:54
duotojh
金虫 (小有名气)
- 应助: 9 (幼儿园)
- 金币: 1066.6
- 红花: 5
- 帖子: 225
- 在线: 137.8小时
- 虫号: 1290636
- 注册: 2011-05-09
- 专业: 生物物理、生物化学与分子
3楼2014-11-13 21:53:09












;
回复此楼