解释一下链表的指针别名怎么使用?我用的有什么问题吗?怎么一直只有输出最后一个输入的字符串

1 #include
2 #include
3 #include
4
5 typedef struct node
6 {

7 char name[20];
8 struct node *plink;
9 }*p_list,NODE;
10
11 void create_node_fun(p_list *new_head)
12 {
13 int len;
14 char str_name[20];
15 p_list new_p = NULL;
16 if(*new_head == NULL)
17 {
18 printf("*new_head == NULL");
19 exit(0);
20 }
21 else
22 {
23 p_list *ptail = new_head;
24 (*ptail)->plink = NULL;
25 printf("input node len =");
26 scanf("%d",&len);
27 for(int i = 0;i < len;i ++)
28 {
29 new_p = (p_list)malloc(sizeof(NODE));
30 if(new_p == NULL)
31 {
32 printf("new_p == NULL");
33 exit(0);
34 }
35 else
36 {
37 scanf("%s",str_name);
38 strcpy(new_p->name,str_name);
39 (ptail)->plink = new_p;
40 new_p->plink = NULL;
41 ptail = new_p;
42 }
43 }
44
45 }
46
47 }
48 void printf_node_fun(p_list *new_head)
49 {
50 p_list *new_p = new_head;
51
52 while((*new_p) != NULL)
53 {
54 printf("%s\n",(*new_p)->name);
55 *new_p = (*new_p)->plink;
56 }
57 }
58 void destroy_node_fun()
59 {
60
61 }
62
63 int main()
64 {
65 p_list head = NULL;
66 head = (p_list)malloc(sizeof(NODE));
44,0-1 89%
67
68 create_node_fun(&head);
69 printf_node_fun(&head);
70 return 0;
71 }

为什么不写成类,这样写出来也不好用啊,链表我倒是经常写,但不带这么写的。

typedef struct 这个是C语言旧的写法,C++不需要
C语言要求你写
typedef struct 结构体名 xxx
这样定义结构体,而不是
结构体名 xxx
为了简化,才需要结构体别名,如今C++直接定义
struct 结构体名
定义
结构体名 xxx