The header file <stdlib.h> defines a number of types, macros, and functions of general utility.
| Types | |
| div_t | Structure containing quotient and remainder after division of ints |
| ldiv_t | Structure containing quotient and remainder after division of longs |
| lldiv_t | Structure containing quotient and remainder after division of long longs |
| String to number conversions | |
| atoi | Convert string to int |
| atol | Convert string to long |
| atoll | Convert string to long long |
| strtol | Convert string to long |
| strtoll | Convert string to long long |
| strtoul | Convert string to unsigned long |
| strtoull | Convert string to unsigned long long |
| Number to string conversions | |
| itoa | Convert int to string |
| ltoa | Convert long to string |
| lltoa | Convert long long to string |
| utoa | Convert unsigned to string |
| ultoa | Convert unsigned long to string |
| ulltoa | Convert unsigned long long to string |
| Integer arithmetic functions | |
| div | Divide two ints returning quotient and remainder |
| ldiv | Divide two longs returning quotient and remainder |
| lldiv | Divide two long longs returning quotient and remainder |
| Pseudo-random sequence generation functions | |
| RAND_MAX | Maximum value returned by rand |
| rand | Return next random number in sequence |
| srand | Set seed of random number sequence |
| Memory allocation functions | |
| calloc | Allocate space for an array of objects and initialize them to zero |
| free | Frees allocated memory for reuse |
| malloc | Allocate space for a single object |
| realloc | Resizes allocated memory space or allocates memory space |
| Search and sort functions | |
| bsearch | Search a sorted array. |
| qsort | Sort an array. |
| Exit functions | |
| atexit | Register functions to call on exit. |
| exit | Terminate the application. |