# stdlib.h ## **Overview** **Related Modules:** [UTILS](UTILS.md) **Description:** Declares common functions used for performing I/O operations. You can use the functions provided in this file to complete string conversion, random number generation, array sorting, and tree-related operations during development. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Data Structures
atoi (const char *nptr) |
|
atol (const char *nptr) |
|
atoll (const char *nptr) |
|
atof (const char *nptr) |
Converts an input string to a double-precision floating-point number. |
strtof (const char *nptr, char **endptr) |
|
strtod (const char *nptr, char **endptr) |
|
strtold (const char *nptr, char **endptr) |
|
strtol (const char *nptr, char **endptr, int base) |
Converts a string to a long integer according to the given base. |
strtoul (const char *nptr, char **endptr, int base) |
Converts a string to an unsigned long integer according to the given base. |
strtoll (const char *nptr, char **endptr, int base) |
Converts a string to a long long integer according to the given base. |
strtoull (const char *nptr, char **endptr, int base) |
Converts a string to an unsigned long long integer according to the given base. |
rand (void) |
|
srand (unsigned int seed) |
|
malloc (size_t size) |
|
calloc (size_t nmemb, size_t size) |
|
realloc (void *ptr, size_t size) |
Changes the size of the memory block pointed to by ptr to size bytes. |
free (void *ptr) |
|
abort (void) |
Terminates an abnormal process and sends the SIGABRT signal to the caller. |
atexit (void(*func)(void)) |
|
exit (int status) |
Terminates the calling process, clears the used memory space and various data structures in the kernel, and sends the process end status to the parent process. All functions registered with atexit and on_exit are called in the reverse order. |
getenv (const char *name) |
|
_Exit (int status) |
Terminates the calling process, clears the used memory space and various data structures in the kernel, and sends the process end status to the parent process. |
assert (scalar expression) |
|
secure_getenv (const char *name) |
|
bsearch (const void *key, const void *base, size_t nel, size_t width, int(*compar)(const void *, const void *)) |
Searches for key using the binary search algorithm from the array element base[0] to base[num-1]. |
qsort (const void *base, size_t nel, size_t width, int(*compar)(const void *, const void *)) |
Sorts array elements base[0] to base[num-1] based on the comparison rules of compar. |
abs (int i) |
|
labs (long i) |
|
llabs (long long i) |
|
div (int numerator, int denominator) |
Calculates the quotient and remainder of an integer after division. |
ldiv (long numerator, long denominator) |
Calculates the quotient and remainder of a long integer after division. |
lldiv (long long numerator, long long denominator) |
Calculates the quotient and remainder of a long long integer after division. |
mblen (const char *s, size_t n) |
|
mbtowc (wchar_t *pwc, const char *s, size_t n) |
|
wctomb (char *s, wchar_t wc) |
Converts a wide character to its multi-byte sequence and stores it in a character array. |
mbstowcs (wchar_t *dest, const char *src, size_t n) |
|
wcstombs (char *dest, const wchar_t *src, size_t n) |
|
posix_memalign (void **memptr, size_t alignment, size_t size) |
Allocates memory with the specified size based on the given alignment. |
setenv (const char *name, const char *value, int overwrite) |
|
unsetenv (const char *name) |
|
mkstemp (char *template) |
|
mkostemp (char *template, int flags) |
|
mkdtemp (char *template) |
|
getsubopt (char **optionp, char *const *tokens, char **valuep) |
|
rand_r (unsigned *seedp) |
|
realpath (const char *__restrict path, char *__restrict resolved) |
|
random (void) |
|
srandom (unsigned int seed) |
|
initstate (unsigned int seed, char *state, size_t n) |
|
setstate (char *state) |
|
putenv (char *s) |
|
unlockpt (int fd) |
Unlocks the secondary pseudo terminal corresponding to a primary pseudo terminal. |
ptsname (int fd) |
|
l64a (long value) |
|
a64l (const char *str64) |
Converts between a 32-bit long integer and a little-endian 64-bit ASCII string. |
drand48 (void) |
|
erand48 (unsigned short xsubi[3]) |
|
lrand48 (void) |
Generates pseudo-random numbers evenly distributed between [0, 2^31). |
nrand48 (unsigned short xsubi[3]) |
Generates pseudo-random numbers evenly distributed between [0, 2^31). |
mrand48 (void) |
Generates pseudo-random numbers evenly distributed between [-2^31, 2^31). |
jrand48 (unsigned short xsubi[3]) |
Generates pseudo-random numbers evenly distributed between [-2^31, 2^31). |
srand48 (long int seedval) |
Sets the start seed value for the pseudo-random number generator. |
seed48 (unsigned short[3]) |
|
lcong48 (unsigned short param[7]) |
Sets the seed and related algorithm parameters for the pseudo-random number generator. |
mktemp (char *template) |
|
mkstemps (char *template, int suffixlen) |
|
mkostemps (char *template, int suffixlen, int flags) |
|
valloc (size_t size) |
Allocates memory with the specified size and aligns the allocated memory by page size. |
ecvt (double number, int ndigits, int *decpt, int *sign) |
Converts a double-precision floating-point number into a string. |
fcvt (double number, int ndigits, int *decpt, int *sign) |
|
gcvt (double x, int n, char *b) |