The C++ <cstdlib> header defines several general purpose functions which includes dynamic memory management, random number generation, communication with the environment, integer arithmetics, searching, sorting and converting.
Functions | Description |
atof() |
Convert string to double. |
atoi() |
Converts a byte string to an integer value. |
atol() |
Converts a byte string to a long integer value. |
atoll() |
Converts a byte string to a long long integer value. |
strtod() |
Converts string to double. |
strtof() |
Converts string to float. |
strtol() |
Convert string to long integer. |
strtold() |
Converts string to long double. |
strtoll() |
Convert string to long long integer. |
strtoul() |
Convert string to unsigned long integer. |
strtoull() |
Convert string to unsigned long long integer. |
Functions | Description |
calloc() |
Allocate and zero-initialize array. |
free() |
Deallocates previously allocated memory. |
malloc() |
Allocates memory. |
realloc() |
Reallocates previously allocated memory block. |
Functions | Description |
rand() |
Returns a pseudo-random integral value between 0 and RAND_MAX. |
srand() |
Seeds the pseudo-random number generator used by rand() with the value seed. |
Functions | Description |
abort() |
Aborts the current process. |
getenv() |
Gets environment string. |
Functions | Description |
abs() |
Returns absolute value of an integral value. |
div() |
Returns quotient and remainder of integer division. |
labs() |
Returns absolute value of an integral value. |
ldiv() |
Returns quotient and remainder of integer division. |
llabs() |
Returns absolute value of an integral value. |
lldiv() |
Returns quotient and remainder of integer division. |
Functions | Description |
mblen() |
Returns the number of bytes in the next multibyte character. |
mbtowc() |
Converts the next multibyte character to wide character. |
wctomb() |
Converts a wide character to its multibyte representation. |