doppelter durchlauf bei verk. liste
-
Okay, auf meinem System läuft es nicht...
Aber ich hab's trotzdem versucht.
Was passiert wenn Du folgendes compilierst?bool isRel(*Relations r){ return r->relType == rel; } bool isSyn(*Relations r1, *Relations r2){ return ( (strcmp(r2->word, r1->dest) == 0) && (strcmp(r1->word, r2->dest) == 0)); } int checksyn(Relations *head) { char rel = 'S'; Relations *aktuell = head; Relations *aktuell2 = head; while (aktuell != NULL) { if(isRel(aktuell)) //Test auf rel = "S" { while (aktuell2 != NULL) { if(isRel(aktuell2) && isSyn(aktuell,aktuell2)) { printf("match found for: %c %s %s\n",aktuell->relType, aktuell->word, aktuell->dest); } else { printf("no match found for: %c %s %s\n", aktuell->relType, aktuell->word, aktuell->dest); } aktuell2 = aktuell2->next; //incrementiert die 2.Liste } } aktuell = aktuell->next; //incrementiert die 1.Liste aktuell2 = head; //setzt die 2.Liste auf ihren Ursprung zurück } return 0; }