x

C – stdlib.h library functions

Prev     Next

C stdlib.h library functions:


All C inbuilt functions which are declared in stdlib.h header file are given below. The source code for stdlib.h header file is also given below for your reference.


List of inbuilt C functions in stdlib.h file:

Function
Description
malloc() This function is used to allocate space in memory during the execution of the
program.
calloc() This function is also like malloc () function. But calloc () initializes the allocated
memory to zero. But, malloc() doesn’t
realloc() This function modifies the allocated memory size by malloc () and calloc ()
functions to new size
free() This function frees the allocated memory by malloc (), calloc (), realloc () functions
and returns the memory to the system.
abs() This function 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 division operation
abort() It terminates the C program
exit() This function terminates the program and does not return any value
system() This function 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 environment variable
putenv() This function modifies the value for environment variable
perror() This function displays most recent error that happened during library function call.
rand() This function returns the random integer numbers
delay() This function Suspends the execution of the program for particular time

Source code for stdlib.h header file:

Please find the source code for stdlib.h header file below. This code is taken from DevC++ compiler files for your reference.

Prev     Next



Like it? Please Spread the word!