C library functions
Library functions are built-in functions that are grouped together and placed in a common location called
library.
Each function here performs a specific operation. We can use this library functions to get the pre-defined
output.
All C standard library functions are declared by using many header files. These library functions are
created at the time of designing the compilers.
We include the header files in our C program by using #include<filename.h>. Whenever the program is
run and executed, the related files are included in the C program.
Header File Functions
Some of the header file functions are as follows −
stdio.h − It is a standard i/o header file in which Input/output functions are declared
conio.h − This is a console input/output header file.
string.h − All string related functions are in this header file.
stdlib.h − This file contains common functions which are used in the C programs.
math.h − All functions related to mathematics are in this header file.
time.h − This file contains time and clock related functions.Built functions in stdio.h
C Math Functions
There is also a list of math functions available, that allows you to perform mathematical
tasks on numbers.
To use them, you must include the math.h header file in your program:
#include <math.h>
1. Square Root
To find the square root of a number, use the sqrt() function:
2. Round a Number
The ceil() function rounds a number upwards to its nearest integer, and
the floor() method rounds a number downwards to its nearest integer, and returns the
result:
3 Power
The pow() function returns the value of x to the power of y (xy):
4. Other Math Functions
A list of other popular math functions (from the <math.h> library) can be found in the table
below:
Function Description
abs(x) Returns the absolute value of x
acos(x) Returns the arccosine of x
asin(x) Returns the arcsine of x
atan(x) Returns the arctangent of x
cbrt(x) Returns the cube root of x
cos(x) Returns the cosine of x
exp(x) Returns the value of Ex
sin(x) Returns the sine of x (x is in radians)
tan(x) Returns the tangent of an angle