Wednesday, August 31, 2016

C Library Header – stdlib

The <stdlib.h> header defines several general operation functions and macros.

The <stdlib.h> header shall define the following macro constant:
EXIT_SUCCESS
EXIT_FAILURE
indicates program execution execution status
MB_CUR_MAXMaximum size of multibyte characters
NULLNull pointer
RAND_MAXmaximum possible value generated by rand()

The <stdlib.h> header shall define the following functions:
String conversion:
atofconverts a byte string to a floating point value
atoi
atol
atoll
converts a byte string to an integer value int, long, long long(C99)
strtol
strtoll
converts a byte string to an integer value long, long long(C99)
strtoul
strtoull
converts a byte string to an unsigned integer value long, long long(C99)
strtof
strtod
strtold
converts a byte string to a floating point value float(C99), double, long double(C99)

Pseudo-random sequence generation:
randgenerates a pseudo-random number
srandseeds pseudo-random number generator

Dynamic memory management:
mallocallocates memory
callocallocates and zeroes memory
reallocexpands previously allocated memory block
freedeallocates previously allocated memory
aligned_allocallocates aligned memory (C11)

Environment:
abortcauses abnormal program termination (without cleaning up)
exitcauses normal program termination with cleaning up
quick_exitcauses normal program termination without completely cleaning up (C11)
_Exitcauses normal program termination without cleaning up (C99)
atexitregisters a function to be called on exit() invocation
at_quick_exitregisters a function to be called on quick_exit invocation (C11)
systemcalls the host environment's command processor
getenv
getenv_s(C11)
access to the list of environment variables

Searching and sorting:
bsearchBinary search in array
qsortSort elements of array

Integer arithmetics:
absAbsolute value
divIntegral division
labs Absolute value
ldiv Integral division
llabs Absolute value
lldiv Integral division

Multi-byte characters:
mblenreturns the number of bytes in the next multibyte character
mbtowcconverts the next multibyte character to wide character
wctomb
wctomb_s(C11)
converts a wide character to its multibyte representation

Multibyte strings:
mbstowcs
mbstowcs_s(C11)
converts a narrow multibyte character string to wide string
wcstombs
wcstombs_s(C11)
converts a wide string to narrow multibyte character string

The <stdlib.h> header shall define the following type:
div_tStructure returned by div(struct)
ldiv_tStructure returned by ldiv(struct)
lldiv_tStructure returned by lldiv(struct)
size_tUnsigned integral type



Related topics:
<setdef.h>   |   <stdint.h>   |   <stdio.h>   |   <stdnoreturn.h>   |   <string.h>   |   Standard Library in C

List of topics: C Programming

No comments:

Post a Comment