What are the 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

Built functions in stdio.h

Let’s see what are the built functions present in stdio.h library function.

Sl.No Function & Description
1 printf()
This function is used to print the all char, int, float, string etc., values onto the output screen.
2 scanf()
This function is used to read data from keyboard.
3 getc()
It reads character from file.
4 gets()
It reads line from keyboard.
5 getchar()
It reads character from keyboard.
6 puts()
It writes line to o/p screen.
7 putchar()
It writes a character to screen.
8 fopen()
All file handling functions are defined in stdio.h header file.
9 fclose()
Closes an opened file.
10 getw()
Reads an integer from file.
11 putw()
Writes an integer to file.
12 fgetc()
Reads a character from file.
13 putc()
Writes a character to file.
14 fputc()
Writes a character to file.
15 fgets()
Reads string from a file, one line at a time.
16 fputs()
Writes string to a file.
17 feof()
Finds end of file.
18 fgetchar
Reads a character from keyboard.
19 fgetc()
Reads a character from file.
20 fprintf()
Writes formatted data to a file.
21 fscanf()
Reads formatted data from a file.
22 fputchar
Writes a character from keyboard.
23 fseek()
Moves file pointer to given location.
Moves file pointer at the beginning of the file.
Moves file pointer at given location.
Moves file pointer at the end of file.
27 ftell()
Gives current position of file pointer.
28 rewind()
Moves file pointer to the beginning of the file.
29 putc()
Writes a character to file.
30 sprintf()
Writes formatted output to string.
31 sscanf()
Reads formatted input from a string.
32 remove()
Deletes a file.
33 flush()
Flushes a file.

Updated on: 25-Oct-2023

20K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started