Thread: using qsort with structures

  1. #1
    Registered User
    Join Date
    Feb 2008

    using qsort with structures

    Does anybody know how to use qsort or any other ansi c sorting function with singly linked list?

    For example consider the following structure.

    typedef struct message {
    int messageId;
    char * messageText;
    struct message * next;
    } message;

    Couple of days ago I posted some questions about my unsuccessful attempt to implement my own sorting regime but I couldn't get help with it.
    So please don't treat this thread as duplicate.
    If you are interested in helping with my implementation got to this thread

    Thank you,
    Last edited by jou00jou; 03-10-2008 at 08:00 PM.

  2. #2
    uint64_t...think positive xuftugulus's Avatar
    Join Date
    Feb 2008
    I think there is if you google, an implementation of mergesort. And also for singly linked lists i don't believe it gets any better. You could also check out the website of iMalc one of the fine members of this forum. He really has sorted out everything about sorting, so you might get a good idea how it should be done.
        goto johny_walker_red_label;
    johny_walker_blue_label: exit(-149$);
    johny_walker_red_label : exit( -22$);
    A typical example of programming practices.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 01-23-2008, 04:22 AM
  2. sorting union of structures with q sort
    By colw in forum C Programming
    Replies: 6
    Last Post: 04-09-2002, 09:51 AM
  3. Need help with qsort() and union of structures
    By DanTheMan in forum C Programming
    Replies: 1
    Last Post: 04-02-2002, 08:30 AM
  4. qsort and structures
    By theweirdo in forum C Programming
    Replies: 5
    Last Post: 02-13-2002, 11:11 PM
  5. Methods for Sorting Structures by Element...
    By Sebastiani in forum C Programming
    Replies: 9
    Last Post: 09-14-2001, 12:59 PM