#include #include #include //##################### Struktur und Funktionen zur Stack-Definition ##################### typedef struct NODE { int elem; struct NODE *next; } node; node *empty(node *head){ head=(node *)malloc(sizeof(node)); head->elem=0; head->next=NULL; return head; } char isempty(node *head){ if(head->next==NULL) return 1; return 0; } void push(node *head, int elem){ node *neu=(node *)malloc(sizeof(node)); neu->next=head->next; neu->elem=elem; head->next=neu; } int pop(node *head){ int zahl; if(head->next!=NULL){ node *h=head->next; head->next=h->next; zahl=h->elem; free(h); return zahl; } return -1; } //######################################################################################## void print_stack(node *head){ node *h=head; printf("Head->"); while(h->next!=NULL){ h=h->next; printf("%d->", h->elem); } printf("NULL\n\n"); } int main(void){ node *head; int zzahl, zzahl2, i; srand(time(NULL)); zzahl=rand()%50; head=empty(head); for(i=0; i