Una pregunta en lenguaje C sobre listas enlazadas
# incluir ltstdlib.h gt
estructura? Nódulo
{
int? datos;
estructura? ¿nodo? *Siguiente;
};
int? principal()
{
int? norte,? I,? j,? t;
int? ¿bandera? =?0,?k? =?0,?x;
estructura? ¿nodo? *cabeza,? *Añadir,? *pag,? *q,? *r, *t 1;
¿Cabeza? =?(struct?node*)malloc(sizeof(struct?node));
scanf("d ", ampn);
head->;¿Siguiente? =?NULL
t1? =?head;
¿Para qué? (I?=?1;?I?lt=?n;?i)
{
¿Si? (yo?==?1)
{
scanf("d", amphead->data);
}
Otro
{
¿Suplementario? =?(struct?node*)malloc(sizeof(struct?node));
scanf("d", amp add-gt; data);
add-gt; ¿Próximo? =?NULL
t 1->;¿Siguiente? =?Agregar;
t1? =?Agregar;
}
}
printf("d\n ",n);
p? =?cabeza;
q? =?head->;Siguiente;
¿Cuándo? (P)
{
r? =?q->;Siguiente;
q->;Siguiente? =?p;
p? =?q;
q? =?r;
}
head->;¿Siguiente? =?NULL
¿Encabezado? =?p;
q? =?cabeza;
¿Cuándo? (q!=null)
{
printf("d?",?q->;data);
q? =?q->;Siguiente;
}
printf(" \ n ");
p? =?cabeza;
¿Cuándo? (p)
{
r? =?p;
q? =?p->;Siguiente;
¿Cuándo? (P)
{
¿Y si? (Q->Datos?==?p->Datos)
{
n->
r->¿Siguiente? =?q->;Siguiente;
q? =?q->;Siguiente;
}
Otros
{
q? =?q->;Siguiente;
r? =?r- gt;Siguiente;
}
}
p? =?p->;Siguiente;
}
printf("d\n ",n);
q? =?cabeza;
¿Cuándo? (q?!=?vacío)
{
printf("d?",?q->;datos);
q? =?q->;Siguiente;
}
printf("\n ",?n)
;
¿Volver? 0;
}