C stdlib.h Library Function

C stdlib.h library function: The stdlib.h header defines four variable types, several macros, and various functions for performing general functions. It can be derived as a “standard input-output library“.



C stdlib.h library function

List of inbuilt C functions in <stdlib.h>

Function Description
malloc( ) used to allocate space in memory during the execution of the program
calloc( ) It is also like the malloc () function. But calloc () initializes the allocated memory to zero. But, malloc() doesn’t
realloc( ) modifies the allocated memory size by malloc( ) and calloc( ) functions to new size
free( ) It frees the allocated memory by malloc (), calloc (), realloc() functions and returns the memory to the system
abs( ) It returns the absolute value of an integer. The absolute value of a number is always positive. Only integer values are supported in C.
div( ) This function performs a division operation
abort( ) It terminates the C program
exit( ) This function terminates the program and does not return any value
system() It is used to execute commands outside the C program
atoi() Converts string to int
atol() Converts string to long
atof() Converts string to float
strtod() Converts string to double
strtol() Converts string to long
getenv() This function gets the current value of the environment variable
setenv() This function sets the value for the environment variable
putenv() This function modifies the value for an environment variable
perror() This function displays the most recent error that happened during a library function call
rand() This function returns the random integer numbers
delay() This function suspends the execution of the program for a particular time