Turn Desktop View Off
You are here:   HomeC Programming (Theory)Basic Of C Prog.Write a C program to read formatted data from stdin: how to use scanf.
by Dinesh Thakur Category: Basic Of C Programming

The C standard library provides the executable code and declarations for functionality provided in it. The executable code for the library is provided in separate files, usually in the lib directory, in the installation directory of the compiler. The library files in Turbo C/C++ are named *.LIB, whereas those in the MinGW compiler provided with Dev-C++ and Code :: Blocks are named lib*. a.

The library can be subdivided into several categories, each containing related functionality. The declarations of functionality in each category are provided in separate text files called header files. The important categories (and the corresponding header files) include input/output facilities (stdio.h), mathematical operations (math.h), string manipulations (string. h),character test and classification (ctype.h) and utility operations (stdlib.h), These categories are summarized in Table. Note that the header file names have a ". h" extension. These files are usually kept in a directory named "include" in the installation directory of the C compiler.

                        Important categories in the C standard library


Header file

Example functions

Input/output facility


scanf, printf, getchar, putchar, gets, puts

Mathematical operations


sqrt, sin, cos, log, pow

String manipulations


strcpy, st rcat , strlen, strcmp

Character test and



isalpha, isupper, toupper

Utility operations


jabs, bsearch, qsort, exit, rand

When we use some functionality from the standard library, e. g., a standard library function, the corresponding header file should be included in the program using the #include preprocessor directive, as in

#include <stdio.h>

#include <math.h>

Observe that the standard header file names are enclosed in angle brackets, <and >.Usually header files are included at the beginning of a program (in any order). When we compile the program, another program called C preprocessor prepares an intermediate program file by replacing each #include directive with the contents of the specified header file. Of course, the original C program file is not affected as a result by this replacement. The intermediate program file is then translated by the C compiler to generate an object code (i. e., machine code). This is then processed by another program called the linker which links the standard library function calls in the program with its executable code provided in the library and generates an executable file. This file can then be executed to perform the operations specified in the C program.

Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.

What's New and Popular

Popular Article