Linked List Insertion

This function inserts an entry into an ordered, singly linked list. Each entry in the list is a structure that contains an integer key value, a next pointer, and some other data. The structure is defined as follows:

typedef struct _entry {
    int key;
    int data;
    char name[20];
    struct _entry * next;
} entry, * entry_ptr;

The head of the linked list is saved in a pointer that is stored outside the list itself. Within the list, the next pointer in each entry points to the next element in the list. The end of the linked list is denoted by the next pointer of the last entry being set to NULL.

The order of the list is determined ...

Get Find the Bug A Book of Incorrect Programs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.