1 Star 0 Fork 0

zhuoxue/代码学习的路途

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
lianbiao.c 483 Bytes
一键复制 编辑 原始数据 按行查看 历史
zhuoxue 提交于 2022-10-02 21:52 +08:00 . 202210
#include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node *next;
};
int main(){
struct node *head, *p, *q, *t;
int i, n, a;
scanf("%d", &n);
head = NULL;
for(i = 1;i <= n;i ++){
scanf("%d", &a);
p = (struct node *)malloc(sizeof(struct node));
p -> data = a;
p -> next = NULL;
if(head == NULL){
head = p;
}
else{
q -> next = p;
}
q = p;
}
t = head;
while(t != NULL){
printf("%d ", t -> data);
t = t -> next;
}
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Joci-zhuoxue/the-way-of-code-learning.git
git@gitee.com:Joci-zhuoxue/the-way-of-code-learning.git
Joci-zhuoxue
the-way-of-code-learning
代码学习的路途
f5f473309b7c6b154ad13ea085b951ff3bcfcb83

搜索帮助