stdlib.h

The libc standard utilites header

Author

Martin ‘Solar’ Baute

License

Public Domain

Defines

abort abs atexit atoi atol atoll bsearch calloc div exit free labs ldiv llabs lldiv malloc qsort rand realloc srand strtol strtoll strtoul strtoull _Exit

Linker parameters

-lc

Summary
stdlib.hThe libc standard utilites header
Todo’s
atof(), strtof(), strtod(), strtold()
Constants
RAND_MAXdefines the maxinum number returned by rand
Todo’s
Macro MB_CUR_MAX

Todo’s

atof(), strtof(), strtod(), strtold()

Constants

RAND_MAX

defines the maxinum number returned by rand

Todo’s

Macro MB_CUR_MAX

int rand(void)
Returns a random number between 0 and RAND_MAX
void abort(void)
Raises the abort signal
int abs(int j)
Returns the absolute value of a given integer
int atexit(void (*func)( void ))
adds a function to the list of things to be called upon program exit
int atoi(const char *s)
Converts a string to an int
long int atol(const char *s)
Converts a string to a long int
long long int atoll(const char *s)
Converts a string to a long long
void * bsearch(const void *key,
const void *base,
size_t nmemb,
size_t size,
int (*compar)( const void *, const void * ))
Performs a binary search inside an array of nmemb itens of size bytes
void * calloc(size_t nmemb,
size_t size)
Allocates nmemb consecutive blocks of size bytes, and zeroes the memory
div_t div(int numer,
int denom)
Performs a division on integers both the quotient and remainder are stored in a div_t (_PDCLIB_div_t) struct
void exit(int status)
exits the program with a given status code
void free(void *ptr)
Deallocates a block of memory created by malloc calloc or realloc.
long int labs(long int j)
Returns the absolute value of a given long int
ldiv_t ldiv(long int numer,
long int denom)
Performs a division on long ints both the quotient and remainder are stored in a ldiv_t (_PDCLIB_ldiv_t) struct
long long int llabs(long long int j)
Returns the absolute value of a given long long
lldiv_t lldiv(long long int numer,
long long int denom)
Performs a division on long longs both the quotient and remainder are stored in a lldiv_t (_PDCLIB_lldiv_t) struct
void * malloc(size_t size)
Allocates size bytes of memory
void qsort(void *base,
size_t nmemb,
size_t size,
int (*compar)( const void *, const void * ))
Sorts an array in memory
void * realloc(void *ptr,
size_t size)
Attempts to resize the allocated block of memory given in ptr.
void srand(unsigned int seed)
Sets the new seed to be used by rand
long int strtol(const char *s,
char **endptr,
int base)
Converts a string in s to an long.
long long int strtoll(const char *s,
char **endptr,
int base)
Converts a string in s to an long long.
unsigned long int strtoul(const char *s,
char **endptr,
int base)
Converts a string in s to an unsigned long.
unsigned long long int strtoull(const char *s,
char **endptr,
int base)
Converts a string in s to an unsigned long long.
void _Exit(int status)
exits the program with a given status code, without running atexit scripts