Linked List in C without malloc -


is possible insert unsigned long linked list ordered smallest largest without using malloc or free.

you can pre-allocate bunch of list entries in form of array, pick entries array when insert. of course possible if array either global, or @ otherwise kept in scope duration of insertion operation.

something like:

struct integernode {   int                value;   struct integernode *next; };  struct integernode nodes[100]; /* adjust number of integers */ 

the next step use trivial for loop link items in nodes together, forming linked list of free items. write function de-links node free list , links list, while inserting number.


Comments