LList* convert_intArray_to_LList(int* array, const unsigned int size) - AmiralBl3ndic/CLib_v2 GitHub Wiki

LList* convert_intArray_to_LList(int* array, const unsigned int size)

This function converts an array of integers into a LList


Warning

This function may cause the program to end in case of bad allocation


Parameters:

  • int* array: array of integers to convert
  • const unsigned int size: size of the integers array

Return values:

Pointer on the first element of the generated LList


Example:

LList* myList = NULL;
int* myArray = malloc(4 * sizeof(int));
check_alloc(myArray);

myArray[0] = 42;
myArray[1] = 69;
myArray[2] = 666;
myArray[3] = 1337;

myList = convert_intArray_to_LList(myArray, 4);