void check_alloc(void* p) - AmiralBl3ndic/CLib_v2 GitHub Wiki

void check_alloc(void* p)

This function checks wether the given pointer is correctly allocated (if it does point on something that is not 0 or NULL)

This function uses exit(EXIT_FAILURE) function to stop the program if the pointer is badly allocated


Parameters:

  • void* p: the pointer to check

Example:

int* myPointer = malloc(sizeof(int));
check_alloc(myPointer);