Mam problemik z moją listą xd obstawiam że zrobiłem jakiś głupi błąd bo program się kompiluje, i jakoś nie mogę wyszukać błędu... pomoże ktos ?
typedef struct list{
struct list *next,*prev;
int key;
}lista;
void push(lista *head,int x){
lista *nowy=(lista*)malloc(sizeof(lista));
nowy->key = x;
nowy->next = NULL;
if(head) {
while(head->next) head=head->next;
head->next=nowy;
nowy->prev = head;
}
else {
head=nowy;
head->prev=NULL;
}
}
void show(lista *head){
while(head) {
printf("%d",head->key);
head=head->next;
}
}
main(){
lista *head = NULL;
int i;
for(i=0;i<4;i++){
push(head,i);
}
show(head);
return 0;
}