void insertPrev_LList(LList* myList, int value) - AmiralBl3ndic/CLib_v2 GitHub Wiki

void insertPrev_LList(LList* myList, int value)

This function inserts a new element (node) in a linked list right before its active element


Warning:

This function allocates a new element. Due to use of function check_alloc() the program may stop in case of bad memory allocation


Parameters:

  • LList* myList: pointer on the active element (node) of the linked list
  • int value: value to insert

Example:

LList* myList = init_LList(8); //Size = 8
next_LList(myList);
myList->val = 42;

insertPrev_LList(myList, 1337); //Size = 9
prev_LList(myList);
myList->val; // = 1337