What are the C library functions?

CServer Side ProgrammingProgramming

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.NoFunction & Description
1printf()
This function is used to print the all char, int, float, string etc., values onto the output screen.
2scanf()
This function is used to read data from keyboard.
3getc()
It reads character from file.
4gets()
It reads line from keyboard.
5getchar()
It reads character from keyboard.
6puts()
It writes line to o/p screen.
7putchar()
It writes a character to screen.
8fopen()
All file handling functions are defined in stdio.h header file.
9fclose()
Closes an opened file.
10getw()
Reads an integer from file.
11putw()
Writes an integer to file.
12fgetc()
Reads a character from file.
13putc()
Writes a character to file.
14fputc()
Writes a character to file.
15fgets()
Reads string from a file, one line at a time.
16f puts()
Writes string to a file.
17feof()
Finds end of file.
18fgetchar
Reads a character from keyboard.
19fgetc()
Reads a character from file.
20fprintf()
Writes formatted data to a file.
21fscanf()
Reads formatted data from a file.
22fputchar
Writes a character from keyboard.
23fseek()
Moves file pointer to given location.
24SEEK_SET
Moves file pointer at the beginning of the file.
25SEEK_CUR
Moves file pointer at given location.
26SEEK_END
Moves file pointer at the end of file.
27ftell()
Gives current position of file pointer.
28rewind()
Moves file pointer to the beginning of the file.
29putc()
Writes a character to file.
30sprint()
Writes formatted output to string.
31sscanf()
Reads formatted input from a string.
32remove()
Deletes a file.
33flush()
Flushes a file.
raja
Published on 08-Mar-2021 05:48:09
Advertisements