#include
#include
typedef struct _node
{
int data;
struct _node *next;
} node;
int main(void)
{
node head, *p, *t, *first, *second;
int n, x;
scanf("%d", &n);
head = (node)malloc(sizeof(node));
head->next = NULL;
p = head;
for(int i=0; i {
scanf("%d", &x);
t = (node*)malloc(sizeof(node));
t->data = x;
t->next = NULL;
p->next = t;
p = t;
}
scanf("%d", &x);
for(int i=0; i {
first = head;
second = head->next;
while(second != NULL && second->data != x)
{
first = second;
second = second->next;
}
if(second != NULL)
{
p = second;
first->next = second->next;
free(p);
}
}
p = head->next;
while(p != NULL)
{
printf("%d ", p->data);
p = p->next;
}
p = head->next;
while(p != NULL)
{
head->next = p->next;
free(p);
p = head->next;
}
free(head);
return 0;
}
for(int i=0; i {
鬼知道你写了什么玩意