1.知识点:顺序建立链表
2.题意:输入N个整数,按照输入的顺序建立单链表存储,并遍历所建立的单链表,输出这些数据
3.注意事项:尾指针移动
代码:
#include <stdio.h>
#include <stdlib.h>
typedef struct st
{
int num;
struct st *next;
}str;
int main()
{
int n, i;
str *head, *tail, *p;
head = (str *)malloc(sizeof(str));/*动态申请内存*/
head -> next = NULL;
tail = head;
scanf("%d", &n);