Library Functions in C

Library functions in C: These are built-in functions which are grouped together and placed in a common place called a library. While Each library function in C performs a specific operation.

  • All C  standard library functions are declared in header files named as file_name.h
  • Actually, function declaration and definition of macros are given in all header files.
  • These library functions are created by the persons who designed and created C compilers.
  • The function declaration, definition for macros are given in all header files.
  • We are including these header files in our C program using “#include<file_name.h>” a command to make use of the functions that are declared in the header files.

Library Functions in C

Here we are listing special header files used in C.

  1. stdio.h
  2. conio.h
  3. string.h
  4. stdlib.h
  5. math.h
  6. time.h
  7. ctype.h
  • If you would like to check the remaining all the header files so that you can check inside the “include” directory after the C compiler has been installed in your device.

List of most used Header files in C programming

Check the below table to know all the library functions and header files in which they are declared.

Header file Description
stdio.h This is standard input/output header file in which Input/Output functions are declared
conio.h This is the console input/output header file
string.h All string related functions are defined in this header file
stdlib.h This header file contains general functions used in C programs
math.h Here all maths-related functions are defined in this header file
time.h This header file contains the time and clock-related functions
ctype.h All character handling functions are defined in this header file
stdarg.h The variable argument functions are declared in this header file
signal.h The Signal handling functions are declared in this file
setjmph.h This file contains all jump functions
locale.h All file contains locale functions
errno.h All the Error handling functions are given in this file
assert.h All the diagnostics functions are present here.

Example

#include<stdio.h>
#include<ctype.h>
#include<math.h>
void main() {
int i = -10, e = 2, d = 10;/* Variables Defining and Assign values */
float rad = 1.43;
double d1 = 3.0,d2 = 4.0;
printf("%d\n", abs(i);
printf("%f\n",sin(rad));
printf("%f\n", cos(rad));
printf("%f\n", exp(e));
printf("%d\n", log(d));
printf("%f\n", pow(d1, d2));
}

Output
10
0.990105
0.140332
7.389056
-1145744106
81.000000