Help sorting informations from an array of structs
Posted on 2004-10-26
Hi everybody, I've started a project not far ago and I'm and now starting the last part.
I've previously programmed an array that contains structs, each structs containing different information. I must now take these informations and sort them to print a cute little list. The problem is that I need to print 2 differents lists, each using the quicksort method to sort the array on different record of a struct, but 1 ascending and the other decreasing.
Now the reason I'm posting this is to get some advices on the best way to understand and solve this problem. I don't have a large knowledge of C language so every help would be appreciated. Should I start by programming a quicksort function taking an array of struct or reading every struct of the array individually and ? Which step should I take first ? Right now it's looking like a giantic task for me butonce I plan the correct steps I hopw it will get easier !
Here my main struct just for the record:
typedef struct book bookInfo;
and here's my array of struct:
bookInfo *books = NULL;
Thanks all for your time.