|
|
The standard function library defines several utility functions. They include various conversions, variable-length argument processing, sorting and searching, and random number generation. Many of the functions covered here require the use of the C header <stdlib.h> or its C++ equivalent <cstdlib>. This chapter will use the C header name, but references to <stdlib.h> also apply to <cstdlib>.
In <stdlib.h> are declared the types div_t and ldiv_t, which are the types of the values returned by div( ) and ldiv( ), respectively. C99 adds the lldiv_t type and the lldiv( ) function. Also declared are the types size_t and wchar_t. The following macros are also defined:
Macro | Meaning |
---|---|
MB_CUR_MAX | Maximum length (in bytes) of a multibyte character |
NULL | A null pointer |
RAND_MAX | The maximum value that can be returned by the rand( ) function |
EXIT_FAILURE | The value returned to the calling process when a program terminates because of an abnormal condition |
EXIT_SUCCESS | The value returned to the calling process when a program terminates normally |
If a function requires a header other than <stdlib.h>, that function description will discuss it.
|
|