链表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
struct Gundam
{
int hp;
int atk;
char name[100];
};
struct Human
{
int age;
char name[100];
Gundam robot;
};

struct Node {
int num;
Node* pointer;
};

int main()
{
/*
Human yzy;
yzy.age = 18;
yzy.robot.hp = 0;
yzy.robot.atk = 0;
scanf("%s", yzy.robot.name);
scanf("%s", yzy.name);
printf("%s", yzy.name);
*/
int s0[10];

Node* head = (Node*)malloc(sizeof(Node));
Node* real_head = head;
for (int i = 0; i < 10; i++) {
Node* current = (Node*)malloc(sizeof(Node));
current->pointer = NULL;
current->num = 0;

head->num = i;
head->pointer = current;
head = current;
}

while (real_head->pointer != NULL) {
printf("%d\n", real_head->num);
real_head = real_head->pointer;
}
}

链表
http://example.com/2023/02/09/链表/
作者
oyxb_HT
发布于
2023年2月9日
更新于
2023年5月20日
许可协议