The library provides a basic set of mathematical functions, string manipulation, type conversions, and file and console‒based I/O.
BUILT‒IN
(LIBRARY) FUNCTIONS
The
ANSI C standard library consists of wide range of C header files which can be
included into a programmer's project with a single directive. Each header file
contains one or more function declarations, data type definitions and macros.
The
library provides a basic set of mathematical functions, string manipulation,
type conversions, and file and console‒based I/O.
C
language provides built‒in functions or intrinsic functions called Library
Functions. The complier itself evaluates these functions. The following table
shows some popular library functions.


1.
sqrt(x): This function evaluates square root
'x'. Note that the argument must be non‒negative.
Example:
sqrt(25)
sqrt (b*b‒4*a*c)
Here
√25 is evaluated as 5
Here
√[b2‒4ac] is evaluated. If b2‒4ac is negative an error
message is displayed.
2.
log(x): Where the argument 'x' must be real.
Here loge x is evaluated.
Example:
log (7.5‒x*y)
Evaluate
loge (7.5‒xy)
3.
abs(x): The absolute value of 'x' is the value
of 'x' without sign. The abs() function evaluates the absolute value of an
integer quantity.
Example: abs(‒75)
Here
the absolute value of ‒75 is 75
4.
fabs(x): The fabs() function evaluates the absolute value of a floating point
quantity.
5.
exp(x): This function evaluates ex. Its general form is exp(). The argument x must be a real
quantity. 'e' is a mathematical
constant between 2 and 3.
Example:
exp (7.5)
Evaluates
e7.5
6.
pow(a,b): Where the arguments 'a' and 'b' are may
be integer or float values. This evaluates the value of ab.
Example:
pow(3,2)
Evaluates
(3)2
7.
ceil(x): The argument 'x' may be integer or
float. This evaluates the ceiling of
the value x. Ceiling of a number 'x'
is the smallest integer greater than or equal to 'x'.
Example:
ceil(5.6)
Evaluates
6
8.
fmod(x,y): Where the arguments may be integer or
float values. This functions returns the remainder, when 'x' is divided by 'y':
Example:
fmod(7,3)
Evaluates
1, because, when 7 is divided by 3 the remainder is 1.
9.
rand(): This will return a random positive
integer number. Note that no arguments are necessary here.
10.
srand(u): Where the argument is quantity. This
initializes the random number generator.
11.
sin(x): This evaluates the trigonometric sine value of a real or integer
quantity given in radian measure.
Example:
sin(30)
Evaluates
0.5
12.
cos(x): This evaluates the trigonometric cosine of a real or integer quantity.
The argument 'x' must be given in radian measure.
Example
: cos(30)
Evaluates
the cosine value of 0.75 radians
i.e., 0.866
13.
tan(x): This evaluates the trigonometric tangent of a real or integer quantity
given in radian measure.
Example:
tan(30)
Evaluates
tan(30), i.e., 0.577
14.
toascii(x): Where the argument is a character or
integer value. This function returns the ASCII value of the argument.
Example:
toascii(a)
Evaluates
97
15.
tolower(x): Where the arguments is either a
character or integer value. If the argument is an alphabet, its lowercase
alphabet is returned. If the argument is an integer, and it is ASCII value of
the alphabet, its lower case alphabet is returned.
Example:
tolower('Z')
Evaluates
z
16.
toupper(x): This is similar to the tolower function. This function
converts small letter into the capital letter, where 'x' is a character.
Example
: toupper('a')
Evaluates
A
Computer Programming C: UNIT III: Functions and Pointers : Tag: Computer Science : - Built‒in (Library) C Programming Functions
Computer Programming C
CS25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
English Essentials I
EN25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
தமிழர் மரபு - Heritage of Tamils
UC25H01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Applied Calculus
MA25C01 Maths 1 M1 - 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Applied Physics I
PH25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Applied Chemistry I
CY25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Makerspace
ME25C04 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Computer Programming C
CS25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Computer Programming Python
CS25C02 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Fundamentals of Electrical and Electronics Engineering
EE25C03 1st Semester EEE Depart | 2025 Regulation | 1st Semester 2025 Regulation
Introduction to Mechanical Engineering
ME25C03 1st Semester Mechanical Dept | 2025 Regulation | 1st Semester 2025 Regulation
Introduction to Civil Engineering
CE25C01 1st Semester Civil, Agri Departments | 2025 Regulation | 1st Semester 2025 Regulation
Essentials of Computing
CS25C03 1st Semester - AIDS, CSE, CSE(CY), IT Department | 2025 Regulation | 1st Semester 2025 Regulation
Applied Physics I Laboratory
PH25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Applied Chemistry I Laboratory
CY25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Computer Programming C Laboratory
CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Computer Programming Python Laboratory
CS25C02 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Engineering Drawing
ME25C01 EEE, Mech, Agri, EEE Depts | 2025 Regulation | 2nd Semester 2025 Regulation
Basic Electronics and Electrical Engineering
EE25C04 1st Semester ECE Dept | 2025 Regulation | 1st Semester 2025 Regulation
Essentials of Computing - Laboratory
CS25C03 1st Semester AIDS, CSE, CSE(CY), IT Depts | practical Laboratory Manual | 2025 Regulation | 1st Semester 2025 Regulation