#include <stdio.h>
#include <stdlib.h>
typedef struct node
{
int date;
struct node *next;
}Node;
int main()
{
//creat_linklist
Node *head = NULL, *current, *previous;
int n;
scanf("%d", &n);
while (n--)
{
current = (Node *)malloc(sizeof(Node *));
scanf("%d", ¤t->date);
current->next = NULL;
if (head==NULL)
head = current;
else
previous->next = current;
previous = current;
}
Node *temp;
Node *read;
temp = (Node *)malloc(sizeof(Node *));
scanf("%d", &temp->date); //insert_date
read = head;
while ((read->next->date)>=(temp->date))
read = read->next;
temp->next = read->next;
read->next = temp;
read = head;
while (read!=NULL)
{
printf("%d ", read->date);
read = read->next;
}
}
插入位置为什么不对