Hey guys, I'm trying to figure out what's wrong with my code. The goal here is to insert linked list entries alphabetically. The basic construct of this program is as follows: You start off with a base list of nodes called p2d nodes (they are brought in automatically through the command line). These nodes are connected to one another vertically. From each one of these base nodes extends another linked list in a horizontal direction (conceptually that is). These horizontal nodes are called p1d nodes. These p1d nodes are the ones I'm trying to insert alphabetically. The variable "first" represents the first horizontal p1d attached to the vertical p2d node. Here is the code segment of interest:
Code:if(p2d->first==NULL){ p2d->first=p1d; } else{ while(strcmp(p2d->first->name, p1d->name) != 1){ p2d->first=p2d->first->next; } p1d->next= p2d ->first; p2d->first = p1d; }