Concepts of library functions

  • Library functions in C language are inbuilt functions which are grouped together and placed in a common place called library.
  • Each library function in C performs specific operation.
  • We can make use of these library functions to get the pre-defined output instead of writing our own code to get those outputs.
  • These library functions are created by the persons who designed and created C compilers.
  • All C standard library functions are declared in many header files which are saved as file_name.h.
  • Actually, 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>” command to make use of the functions those are declared in the header files.
  • When we include header files in our C program using “#include<filename.h>” command, all C code of the header files are included in C program. Then, this C program is compiled by compiler and executed.

LIST OF MOST USED HEADER FILES IN C PROGRAMMING LANGUAGE:

  • Check the below table to know all the C library functions and header files in which they are declared.
  • Click on the each header file name below to know the list of inbuilt functions declared inside them.
Header file
Description
stdio.hThis is standard input/output header file in which Input/Output
functions are declared
conio.hThis is console input/output header file
string.hAll string related functions are defined in this header file
stdlib.hThis header file contains general functions used in C programs
math.hAll maths related functions are defined in this header file
time.hThis header file contains time and clock related functions
ctype.hAll character handling functions are defined in this header file
stdarg.hVariable argument functions are declared in this header file
signal.hSignal handling functions are declared in this file
setjmp.hThis file contains all jump functions
locale.hThis file contains locale functions
errno.hError handling functions are given in this file
assert.hThis contains diagnostics functions
C Language: Standard Library Functions - stdio.h
In the C Programming Language, the Standard Library Functions are divided into several header files.
The following is a list of functions found within the <stdio.h> header file:

All C inbuilt functions which are declared in stdio.h header file are given below. The source code for stdio.h header file is also given below for your reference.

LIST OF INBUILT C FUNCTIONS IN STDIO.H FILE:

Function
Description
printf()This function is used to print the character, string, float, integer, octal and hexadecimal values onto the output screen
scanf()This function is used to read a character, string, numeric data from keyboard.
getc()It reads character from file
gets()It reads line from keyboard
getchar()It reads character from keyboard
puts()It writes line to o/p screen
putchar()It writes a character to screen
clearerr()This function clears the error indicators
f open()All file handling functions are defined in stdio.h header file
f close()closes an opened file
getw()reads an integer from file
putw()writes an integer to file
f getc()reads a character from file
putc()writes a character to file
f putc()writes a character to file
f gets()reads string from a file, one line at a time
f puts()writes string to a file
f eof()finds end of file
f getcharreads a character from keyboard
f getc()reads a character from file
f printf()writes formatted data to a file
f scanf()reads formatted data from a file
f getcharreads a character from keyboard
f putcharwrites a character from keyboard
f seek()moves file pointer position to given location
SEEK_SETmoves file pointer position to the beginning of the file
SEEK_CURmoves file pointer position to given location
SEEK_ENDmoves file pointer position to the end of file.
f tell()gives current position of file pointer
rewind()moves file pointer position to the beginning of the file
putc()writes a character to file
sprint()writes formatted output to string
sscanf()Reads formatted input from a string
remove()deletes a file
fflush()flushes a file

No comments:

Post a Comment