int setActiveElement_LList(LList* myList, const unsigned int index) - AmiralBl3ndic/CLib_v2 GitHub Wiki

int setActiveElement_LList(LList* myList, const unsigned int index)

This function sets the active element (node) of the given LList to the index specified


Parameters:

  • LList* myList: Pointer on any element of the LList
  • const unsigned int index: index of the element to set active

Return values:

  • 0: the specified index is not reachable, active element set to last element
  • 1: everything worked fine, active element set to element n° index

Example:

LList* myList = init_LList(8);

setActiveElement_LList(myList, 4); //Returns 1, sets active element to the 5th
setActiveElement_LList(myList, 42); //Returns 0, sets active element to the 8th
⚠️ **GitHub.com Fallback** ⚠️