Libraries and Library function

Libraries are the files of ready-compiled code that the compiler merges, or links, with a C program during compilation. For example, there are libraries of mathematical functions, string handling functions, and input/output functions. Indeed, most of the facilities C offers are provided as libraries. Most C programs include at least one library. You need to ensure both that the library is linked to your program and that its header files are included in your program. libraries have header files that define information to be used in

conjunction with the libraries, such as functions and data types. When you include a header file, the compiler adds the functions, data types, and other information in the header file to the list of reserved words and commands in the language. After that, you cannot use the names of functions or macros in the header file to mean anything other than what the library specifies, in any source code file that includes the header file. The most commonly used header file is for the standard input/output routines is called `stdio.h’. This and other header files are included with the #include command at the top of a source code file.

For example,

#include <name.h>

Many basic housekeeping functions are available to a C program in form of standard library functions. To call these, the program must #include the appropriate .h file. Most compilers link in the standard library code by default. Some commonly used header files are listed below.

stdio.h: file input and output
string.h: string operations
math.h: mathematical functions such as sin() and cos()
stdlib.h: utility functions such as malloc() and rand()
time.h: date and time

Header files include library functions some commonly used library functions are printf(), scanf(), gets(), puts(), fflush(), pow(), sqrt(), clrscr(), getche(), getchar(), getch(), exit(), etc. We will use these functions and more functions in our program.