C- Doppelt verkettete Liste
Muss bis Dienstag die Hausübung fertig haben, habe aber jetzt schon seit über einem Jahr kein C mehr gemacht so das ich vollkommen draußen bin.
Die aufgabe: eine doppelt verkettete Liste, mit einfügen suchen löschen...
Bei mir hängt er im Moment an der Zeile:
struct node *temp;
Wieso, und kann mir jemand bitte schnell helfen!!!
#include<stdio.h>
#include<stdlib.h>
struct node{
int Katnr;
int Ktostand;
struct node *prev;
struct node *next;
};
void insert(int zahl1, int zahl2, struct node *point);
void main(){
struct node *root=NULL, *found;
char ein[130];
int z1,z2,loop=1,menu;
while(loop){
printf("0 Datensatz eingeben\n1 Datensatz suchen\n2 Datensatz l”schen\n3 Beenden\n");
menu=atoi(gets(ein));
switch(menu)
{
case 0:
struct node *temp;
printf("\nBitte Katalognummer eingeben: ");
z1=atoi(gets(ein));
printf("\nBitte Kontostand eingeben: ");
z2=atoi(gets(ein));
if(root==NULL){
root=malloc(sizeof(struct node));
root->Katnr=z1;
root->Ktostand=z2;
}
else insert(z1,z2,root);
break;
case 3: loop=0;
break;
default: printf("Bitte gltige Zahl eingeben");
}
}
}
void insert(int zahl1, int zahl2, struct node *point){
if(point->next==NULL){
struct node *new;
new = (struct node *)malloc(sizeof(struct node));
new->Katnr=zahl1;
new->Ktostand=zahl2;
new->prev=point;
point->next=new;
}
else
insert (zahl1, zahl2, point->next);
}
____________________________________
Resistantium est futilius
|