calloc
Syntax:
#include <stdlib.h> void* calloc( size_t num, size_t size ); The calloc() function returns a pointer to space for an array of num objects, each of size size. The newly allocated memory is initialized to zero. calloc() returns NULL if there is an error. |
#include <stdlib.h> void free( void* ptr );
The free() function deallocates the space pointed to by ptr, freeing it up for future use. ptr must have been used in a previous call to malloc(), calloc(), or realloc(). An example:
typedef struct data_type { int age; char name[20]; } data; data *willy; willy = (data*) malloc( sizeof(*willy) ); ... free( willy );