typedef struct node0
{
int data;
struct node0* next;
}node;
int pri(node *head)
{
node *i=head;
while(i!=NULL)
{
printf("%d ",i->data);
i=i->next;
}
printf("\n");
return 0;
}
int insert(node *head,int n)
{
node *temp1 = (node*)malloc(sizeof(node));
temp1 = head;
for(int i=2;i<n;i++)
{
temp1 = head->next;
head = temp1;
if(head->next==NULL)
{
break;
}
}
node *new = (node*)malloc(sizeof(node));
new->next = temp1->next;
head->next = new;
new->data = 222;
}
int deleted(node *head,int n)
{
node *temp1 = (node*)malloc(sizeof(node));
for(int i=2;i<n;i++)
{
temp1 = head->next;
head = temp1;
if(head->next==NULL)
{
exit(1);
}
}
head->next=head->next->next;
temp1=next->next;
free(temp1);
}
链表的打印 插入 删除
最新推荐文章于 2021-12-09 22:02:15 发布