Pages

Friday 4 July 2014

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:


S.no
Function
Description
1 malloc() This function is used to allocate space in memory during the execution of the
program.
2 calloc() This function is also like malloc () function. But calloc () initializes the allocated
memory to zero. But, malloc() doesn’t
3 realloc() This function modifies the allocated memory size by malloc () and calloc ()
functions to new size
4 free() This function frees the allocated memory by malloc (), calloc (), realloc () functions
and returns the memory to the system.
5 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.
6 div() This function performs division operation
7 abort() It terminates the C program
8 exit() This function terminates the program and does not return any value
9 system() This function is used to execute commands outside the C program.
10 atoi() Converts string to int
11 atol() Converts string to long
12 atof() Converts string to float
13 strtod() Converts string to double
14 strtol() Converts string to long
15 getenv() This function gets the current value of the environment variable
16 setenv() This function sets the value for environment variable
17 putenv() This function modifies the value for environment variable
18 perror() This function displays most recent error that happened during library function call.
19 rand() This function returns the random integer numbers
20 delay() This function Suspends the execution of the program for particular time

0 comments:

Post a Comment