Skip to content
This repository was archived by the owner on Mar 12, 2018. It is now read-only.

void check_alloc(void* p)

Camille Briand edited this page Sep 7, 2017 · 3 revisions

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);

Clone this wiki locally