Which header file is used for mathematical functions in C?
a) stdlib.h
b) math.h
c) string.h
d) stdio.h
Answer:
b) math.h
Explanation:
The math.h
header file in C is used to include mathematical functions such as sin()
, cos()
, sqrt()
, pow()
, and many others. These functions are essential for performing complex mathematical calculations in C programs. Including this header allows you to use a wide range of mathematical operations without having to implement them from scratch.
Understanding the math.h
library is important for performing mathematical computations in C efficiently.