##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Standard library header <cstdlib>

From cppreference.com
< cpp‎ | header

This header was originally in the C standard library as `<stdlib.h>`.

This header provides miscellaneous utilities. Symbols defined here are used by several library components.

### Macros
EXIT_SUCCESS EXIT_FAILURE | indicates program execution execution status (macro constant) [edit]
RAND_MAX | maximum possible value generated by std::rand (macro constant) [edit]
### Classes
`div_t ldiv_t lldiv_t` | the quotient and remainder of integer division (struct)
### Functions
##### Process control
abort | causes abnormal program termination (without cleaning up) (function) [edit]
exit | causes normal program termination with cleaning up (function) [edit]
quick_exit (C++11) | causes normal program termination without completely cleaning up (function) [edit]
_Exit (C++11) | causes normal program termination without cleaning up (function) [edit]
atexit | registers a function to be called on std::exit() invocation (function) [edit]
at_quick_exit (C++11) | registers a function to be called on `quick_exit` invocation (function) [edit]
system | calls the host environment's command processor (function) [edit]
getenv | access to the list of environment variables (function) [edit]
##### Memory management
malloc | allocates memory (function)
calloc | allocates and zeroes memory (function)
realloc | expands previously allocated memory block (function)
free | deallocates previously allocated memory (function)
##### Numeric string conversion
atof | converts a byte string to a floating point value (function) [edit]
atoi atol atoll | converts a byte string to an integer value (function) [edit]
strtol strtoll | converts a byte string to an integer value (function) [edit]
strtoul strtoull | converts a byte string to an unsigned integer value (function) [edit]
strtof strtod strtold | converts a byte string to a floating point value (function) [edit]
##### Wide string manimpulation
mblen | returns the number of bytes in the next multibyte character (function) [edit]
mbtowc | converts the next multibyte character to wide character (function) [edit]
wctomb | converts a wide character to its multibyte representation (function) [edit]
mbstowcs | converts a narrow multibyte character string to wide string (function) [edit]
wcstombs | converts a wide string to narrow multibyte character string (function) [edit]
##### Miscellaneous algorithms and math
rand | generates a pseudo-random number (function) [edit]
srand | seeds pseudo-random number generator (function) [edit]
qsort | sorts a range of elements with unspecified type (function) [edit]
bsearch | searches an array for an element of unspecified type (function) [edit]
abs(int)labs llabs | computes absolute value of an integral value (|x|) (function)
div ldiv lldiv | the quotient and remainder of integer division (function)

### [edit] See Also

- Program support utilities
- Pseudo-random number generation
- Common mathematical functions
- C memory management library
- Null-terminated byte strings
- Null-terminated multibyte strings
- Algorithms library

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/header/cstdlib&oldid=57464"