| 查看: 518 | 回复: 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; } 请问这几句怎么理解? |
» 猜你喜欢
今天系统多次维护,明天很可能放榜!
已经有5人回复
欢迎发来filecode的Mz6后的代码验证其规律
已经有74人回复
岩土工程学报什么时候才能终审完呐
已经有4人回复
时间戳又变了8-15
已经有25人回复
2027广东省杰青
已经有6人回复
快农历七夕节了,轻松一下,男人悄悄话,女施主请不要进来。
已经有3人回复
哪位老哥知道今年的国自然具体哪一天放榜?
已经有9人回复
咱们一起用铁证分析2026国家社科基金中标与否
已经有26人回复
我的国基提前知道中了,可是同事的操作让我实在接受不了,怎么会有这样的人
已经有16人回复
有时候,自然基金真的不能太认真 (我的申报经验)
已经有12人回复

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










;
回复此楼
25