C standard library

By | February 25, 2024

Prerequisite – C language
C standard library (libc) is the standard library for the C programming language, as specified in the ANSI C standard. C standard library is also called the ISO C library.

The C library functions are provided by the system and stored in the library. The C library function is also called an in-built function in C programming. To use Inbuilt Function in C, you must include their respective header files, which contain prototypes and data definitions of the function.

For example, printf() is a library function used to print on the console and defined in stdio.h (full form : Standard Input/Output) C library. stdio.h has following functionalities in C.

  • printf() is output to the screen
  • scanf() is read input from the screen
  • getchar() is return characters typed on screen
  • putchar() is output a single character to the screen
  • fopen() is open a file, and
  • fclose() is close a file

These are various C standard library :

Full Form Header File Functions
Standard input-output header <stdio.h> Used to perform input and output operations like scanf() and printf().
Console input-output header <conio.h> Used to perform console input and console output operations like clrscr() to clear the screen and getch() to get the character from the keyboard.
String header <string.h> Used to perform string manipulation operations like strlen and strcpy.
Standard library header <stdlib.h> Used to perform standard utility functions like dynamic memory allocation using functions such as malloc() and calloc().
Math header <math.h> Used to perform mathematical operations like sqrt() and pow() to obtain the square root and the power of a number respectively.
Time header <time.h> Used to perform functions related to date and time like setdate() and getdate() to modify the system date and get the CPU time respectively.
Character type header <ctype.h> Used to perform character type functions like isaplha() and isdigit() to find whether the given character is an alphabet or a digit. respectively.
Assertion header <assert.h> Used in program assertion functions like assert() to get an integer data type as a parameter which prints stderr only if the parameter passed is 0.
Localization header <locale.h> Used to perform localization functions like setlocale() and localeconv() to set locale and get locale conventions respectively.
Signal header <signal.h> Used to perform signal handling functions like signal() and raise() to install signal handler and to raise the signal in the program respectively.
Jump header <setjmp.h> Used to perform jump functions.
Standard argument header <stdarg.h> Used to perform standard argument functions like va_start and va_arg() to indicate the start of the variable-length argument list and to fetch the arguments from the variable-length argument list in the program respectively.
Error handling header <errno.h> Used to perform error handling operations like errno() to indicate errors in the program by initially assigning the value of this function to 0 and then later changing it to indicate errors.



Please write comments if you find anything incorrect. A gentle request to share this topic on your social media profile.