MyOS Libc
stdlib.h File Reference
#include <stddef.h>

Go to the source code of this file.

Macros

#define EXIT_SUCCESS   0
 Success exit code.
 
#define EXIT_FAILURE   1
 Failure exit code.
 

Functions

void * malloc (size_t size)
 
void * realloc (void *mem, size_t new_sz)
 
void free (void *mem)
 
void exit (int code)
 

Function Documentation

◆ exit()

void exit ( int  code)

Exit the process

Parameters
codeThe exit code of the process

◆ free()

void free ( void *  mem)

Frees a block of memory on the heap

Parameters
memThe block of memory to free

◆ malloc()

void* malloc ( size_t  size)

Allocates a block of memory on the heap

Parameters
sizeThe size of the block to allocate
Returns
The address of the allocated block, or NUL if the allocation failed

◆ realloc()

void* realloc ( void *  mem,
size_t  new_sz 
)

Changes a block of memory on the heap to a new size, or if mem is NULL, act like malloc

Parameters
memThe block of memory to change size
new_szThe size of the block to allocate
Returns
The new address of the allocated block, or NUL if the allocation failed