Thread: Sorted linked list, please help with missing n

  1. #1
    Registered User
    Join Date
    Oct 2012

    Sorted linked list, please help with missing n

    #include <stdio.h>
    #include <stdlib.h>
    #define TRUE 1
    typedef struct one_node 
        int data;
        struct one_node *next;
    } LL_node, *Node_ptr;
    LL_node *my_node;
    Node_ptr insert_LL_sorted(Node_ptr first, int numb);
    //numb is the parameter to be inserted into the linked list
    //first points to the first node in the linked list
    void print_LL(Node_ptr first);
    //This function displays all elements in linked list
    int main() 
          int numb;
        Node_ptr first;
        first = NULL;     
        printf("Enter positive integer or 0 to end \n");
        scanf("%d", &numb);
        while (numb > 0) 
            first = insert_LL_sorted(first,numb);
            printf("Enter positive integer or 0 to end \n");
        if (first == NULL)
            printf("No inputs made and list is empty\n");
        return TRUE;
    void print_LL(Node_ptr first)
        while (first != NULL) 
            printf("%d\n", first->data);
            first = first->next;
    Node_ptr insert_LL_sorted(Node_ptr first, int numb) 
    //Help with function body here

  2. #2
    Registered User
    Join Date
    Nov 2010
    Long Beach, CA
    Stop spamming us to do your homework for you.

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    New Zealand
    Agreed, this is the third time posting code where you have made no attempt and just want others to do your work for you. We're here to help people learn. You clearly aren't interested in learning, you're interested in a free ride.

    My three strikes rule says I should now tell you to peee off, but seeing as how those were so close together, maybe just maybe I'll give you one last chance to read the forum rules and post your attempt at the bits you cant do, and post some specific questions.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting to sorted linked list
    By sand_man in forum C Programming
    Replies: 12
    Last Post: 05-05-2012, 06:47 PM
  2. sorted linked list
    By budala in forum C Programming
    Replies: 12
    Last Post: 07-29-2009, 08:47 AM
  3. Creating a Sorted Linked List, Help Please!
    By larry_2k4 in forum C Programming
    Replies: 4
    Last Post: 04-28-2009, 01:12 AM
  4. sorted doubly linked list
    By alzar in forum C Programming
    Replies: 11
    Last Post: 01-02-2008, 03:13 AM
  5. sorted linked list
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 02-03-2002, 09:11 PM