C - Library - Stdlib
C - Library - Stdlib
h>
C Library - <stdlib.h>
Advertisements
The stdlib.h header defines four variable types, several macros, and various functions for performing general functions.
Library Variables
Following are the variable types defined in the header stdlib.h −
size_t
1
This is the unsigned integral type and is the result of the sizeof keyword.
wchar_t
2
This is an integer type of the size of a wide character constant.
div_t
3
This is the structure returned by the div function.
ldiv_t
4
This is the structure returned by the ldiv function.
Library Macros
Following are the macros defined in the header stdlib.h −
NULL
1
This macro is the value of a null pointer constant.
EXIT_FAILURE
2
This is the value for the exit function to return in case of failure.
EXIT_SUCCESS
3
This is the value for the exit function to return in case of success.
RAND_MAX
4
This macro is the maximum value returned by the rand function.
MB_CUR_MAX
5
This macro is the maximum number of bytes in a multi-byte character set which cannot be larger than MB_LEN_MAX.
Library Functions
Following are the functions defined in the header stdio.h −
https://www.tutorialspoint.com/c_standard_library/stdlib_h.htm 1/3
1/30/2018 C Library <stdlib.h>
unsigned long int strtoul(const char *str, char **endptr, int base)
6 Converts the string pointed to, by the argument str to an unsigned long integer (type unsigned long int).
void abort(void)
11 Causes an abnormal program termination.
void *bsearch(const void *key, const void *base, size_t nitems, size_t size, int (*compar)(const void *, const void *))
16 Performs a binary search.
void qsort(void *base, size_t nitems, size_t size, int (*compar)(const void *, const void*))
17 Sorts an array.
int abs(int x)
18 Returns the absolute value of x.
int rand(void)
22 Returns a pseudo-random number in the range of 0 to RAND_MAX.
https://www.tutorialspoint.com/c_standard_library/stdlib_h.htm 2/3
1/30/2018 C Library <stdlib.h>
24 int mblen(const char *str, size_t n)
Returns the length of a multibyte character pointed to by the argument str.
Advertisements
YouTube 38B
https://www.tutorialspoint.com/c_standard_library/stdlib_h.htm 3/3