How to sort a linked list like this?
Posted on 2003-03-07
Hi, I need some help for this easy problem..
I defined a struct like this:
struct p_list *next;
typedef struct p_list ELEMENT;
typedef *ELEMENT LINK;
and I need to have a method for creating a list of elements. Something recursive like this:
scanf("%d %s %s", &a, &no, &co);
if (a != 0)
head = malloc(sizeof(ELEMENT));
Suppose this works (not sure of it!), I need a method to put in order the list from the field cognome (italian for Surname!); if two elements have the same surname i order them from the int field..
Can anybody help???