stdlib.h — Standard library functions
The stdlib.h
header file contains declarations for the following functions:
abort() | abs()[1,3] | alloca()[1] | atexit() | atof() |
atoi() | atol() | bsearch() | calloc() | cds()[1] |
clearenv() | cs()[1] | csid() | div()[3] | exit() |
fetch()[2] | fetchep()[2] | free() | getenv() | labs() |
ldiv() | llabs() | lldiv() | __librel() | malloc() |
mblen() | mbstowcs() | mbtowc() | __moservices() | qsort() |
rand() | realloc() | release()[2] | rpmatch() | setenv() |
srand() | strtod() | strtol() | strtoll() | strtoul() |
strtoull() | system() | unatexit() | wcsid() | wcstombs() |
wctomb() | strtod32()[4] | strtod64()[4] | strtod128()[4] |
_UNIX03_SOURCE
unsetenv() |
[1] Built-in function.
[2] Not supported under C++ applications.
[3] Special Behavior for C++: For C++ applications, the functions abs()
and
div()
are also overloaded for the type long.
[4] The __STDC_WANT_DEC_FP__ feature test macro is required to expose decimal floating-point functionality.
Two type definitions are added to stdlib.h for the Compare and Swap functions
cs()
and cds()
. The structures defined are __cs_t
and __cds_t
.
The type size_t
is declared in the header file.
It is used for the type of the value returned by sizeof
.
The type wchar_t
is declared and used for a wide
character constant. For more information on the types size_t
and wchar_t
,
see stddef.h — typedef statements.
The stdlib.h declares div_t
and ldiv_t
, which define the
structure types that are returned by div()
and ldiv()
.
- NULL
- The NULL pointer constant (also defined in stddef.h).
- EXIT_SUCCESS
- Used by the
atexit()
function. - EXIT_FAILURE
- Used by the
atexit()
function. - RAND_MAX
- Expands to an integer representing the largest number that the
RAND
function can return. - MB_CUR_MAX
- Expands to an integer representing the maximum number of bytes
in a multibyte character. This value is dependent on the current locale.
If MB_CUR_MAX is set to 1, multibyte functions will behave as if all multibyte characters are one byte long; wide-character functions are not supported and full DBCS support is not provided. If MB_CUR_MAX is 4, all DBCS support provided by the library is enabled.