Hi all, I have a homework assignment wherein I have to create a custom malloc and free (without ever using the standard functions for both), and I understand how to do this with a linked list, but I've run into a snag.
I want to create a global Linked List in a .c file (which will include a .h file with the struct definitions for a linked list and nodes, and the .c file itself will be included in a driver) with just global variables and the functions for the malloc and free, but I have just learned that you cannot initialize a global variable with a function. Because of this, my plan to use sbrk() to allocate memory for the Linked List will not work. To further complicate this problem, we cannot edit the main function in the driver we are given, so I can't initialize the linked list there. So my question is: is it at all possible to create a global linked list? If so, how?