Header File <stdlib.h>

The header file provides the following functionality:

Macros

EXIT_FAILURE
EXIT_SUCCESS

RAND_MAX

Types

div_t
ldiv_t

Functions

double atof( const char *s );
int atoi( const char *s );
long atol( const char *s );

double strtod( const char *s, char **endp );
long strtol( const char *s, char **endp, int base );
unsigned long strtoul( const char *s, char **endp, int base );

int rand( void );
void srand( unsigned int seed );

void *calloc( unsigned int nobj, unsigned int size );
void *malloc( unsigned int size );
void *realloc( void *p, unsigned int size );
void free( void *p );

void abort( void );
void exit( int status );
int atexit( void (*fcn)(void) );

char *getenv( const char *name );

void *bsearch( const void *key, const void *base, size_t n, size_t size, int (*cmp)(const void *keyval, const void *datum) );

void qsort( void *base, size_t n, size_t size, int (*cmp)(const void *, const void *) );

int abs( int n );
long labs( long n );

div_t div( int num, int denom );
ldiv_t ldiv( long num, long denom );

int rand_r( unsigned int *seed );

int rand_s( void );

unsigned int _rotl( unsigned int val, int shift );
unsigned int _rotr( unsigned int val, int shift );
unsigned long _lrotl( unsigned long val, int shift );
unsigned long _lrotr( unsigned long val, int shift );

 
Limitations

atexit supports a maximum of 32 functions, which is the limit specified by the standard.

Missing

Function system.

Additions

Functions _rotl, _rotr, _lrotl and _lrotr are all in libc.lib.

Function rand_r, posix reentrant version of rand.

Function rand_s, 'secure' version of rand.

Notes

Memory allocation is done using the Global* family of functions.