stdlib.h in standard C Library header file that provides various functions to perform general utility tasks. It includes functions for memory allocation, process control, random number generation, string conversion, and other fundamental operations.
Key functions include malloc()
for dynamic memory allocation, free()
to release allocated memory, exit()
for program termination, atoi()
for converting strings to integers, and rand()
for generating pseudo-random numbers.
Additionally, <stdlib.h>
declares the NULL
macro for null pointers and defines the EXIT_SUCCESS
and EXIT_FAILURE
constants for program termination status.
Overall, <stdlib.h>
is essential for many C programs, offering foundational functionalities crucial for memory management, program flow control, and data conversion.
Functions List
functions are in below table, Refer this link for more info
Function | Description |
---|---|
abort() | Stop a Program. |
abs() | Calculate Integer Absolute Value. |
atexit() | Record Program Ending Function. |
atof() | Convert Character String to Float |
atoi() | Convert Character String to Integer |
atol() & atoll() | Convert Character String to Long or Long Long Integer |
bsearch() | Search Array |
calloc() | Reserve and Initialize Storage |
_C_Quickpool_Debug() | Modify Quick Pool Memory Manager Characteristics |
_C_Quickpool_Init() | Initialize Quick Pool Memory Manager. |
_C_Quickpool_Report() | Generate Quick Pool Memory Manager Report |
div() | Calculate Quotient and Reminder |
exit() | End Program |
free() | Release Storage Blocks |
_gcvt1() | Convert Floating Point to String |
getenv() | Search for Enviroment Variable |
_itoa1() | Convert Integer to String |
_ltoa1() | Convert Integer to String |
labs() | Calculate absolute value of long and long long Integer |
llabs() | Calculate absolute value of long and long long Integer |
ldiv() | Perform Long and Long Long Division |
lldiv() | Perform Long and Long Long Division |
malloc() | Reserve Storage Block |
mblen() | Determine Length of Multibyte Character |
mbstowcs() | Convert Multibyte String to a Wide Character String |
mbtowc() | Convert Multibyte Character to a Wide Character |
putenv() | Change/Add Environmental Variable |
qsort() | Sort Array |
rand() | Generate Random Number |
rand_r() | Generate Random Number |
realloc() | Change Reserved Storage Block Size |
srand() | Set Seed fr rand() Function |
strtod() | Convert Character String to Double, Float, and Long Double |
strtod32() | Convert Character String to Decimal Floating-Point |
strtod64() | Convert Character String to Decimal Floating-Point |
strtod128() | Convert Character String to Decimal Floating-Point |
strtof() | Convert Character String to Double, Float, and Long Double |
strtol() | Convert Character String to Long and Long Long Integer |
strtold() | Convert Character String to Double, Float, and Long Double |
strtoll() | Convert Character String to Long and Long Long Integer |
strtoul() | String to unsigned Long Integer |
strtoull() | String to Unsigned Long Long Integer |
system() | Execute a command |
_ultoa1() | Convert Unsigned Long Integer to String. |
wcstombs() | Convert a Wide Character to a Multibyte Character String |
wctomb() | Convert a Wide Character to a Multibyte Character |