Friday, September 17, 2021

    Header File List And Functions In C Language

    Must Read

    We started this site to inspire young minds to motivate and encourage them towards Programming Language. In this site you will get programming tutorials, tech, programming facts, programming fun and programming blogs.

    In this article, we discuss Header File List And Functions In C Language. Header files contain the set of predefined standard library functions that we can include in our c programs. But to use these various library functions, we have to include the appropriate header files. A header file has a .h extension that contains C function declarations and macro definition. There are two kinds of header files: the files that the developer writes and the files that come with your compiler. When we including a header file in a program, that means we copy the content of the header file.



    Header files include data types definitions, function prototypes, and C preprocessor commands. For example, we use function printf() in the program. then we have to include stdio.h in our C program.

    Let’s see in detail how the compiler interprets the line.


    Here, # is a pre-processor directive which tells us that this is the line which must be pre-processed by pre-processor.

    include tells us that there is a filename ahead which must be included at the top of our program. Preprocessor simply copies contents of file stdio.h in our code.

    <> – Angled brackets defines where to search for header files.

    stdio.h – is the file to be included in our program so that we can use built-in functions in our program. These built-in functions are only declared in such header files and not defined.

    Apart from method or class declarations, header files also contain predefined macros, data type definitions, etc.

    When you call a built-in function, at compile time compiler compares your calling statement with function prototype(which is in the header file) and if the return type, function name, number of arguments, type of arguments are the same then only the result of comparison is said to be satisfying otherwise compiler gives you errors.

    As we have shown above we can create our own header files as well. But they are specified in between double quotes instead of angular brackets which will convene to make programming easier.

    If you have a standard set of instructions that you want to insert in a lot of programs that you are writing then you can do it using the #include statement.

    The # symbol at the start stipulate that this isn’t a C statement but one for the C pre-processor which looks at the text file before the compiler gets it. The #include tells the pre-processor to read in a text file and treat it as if it was part of the program’s text. For example:

    #include “copy.txt”

    could be used to include a copyright notice stored in the file copy.txt. However, the most common use of #include is to define constants and macros. The C pre-processor is almost a language in its own right For example if you define the identifier NULL as:

    #define NULL 0

    then whenever you use NULL in your program the pre-processor substitutes 0. In most cases you want these definitions to be included in all your programs and so the obvious thing to do is to create a separate file that you can #include.

    This idea of using standard include files has spiraled out of all proportions. Now such include files are called header files and they are distinguished by ending in the extension .h. A header file is generally used to define all of the functions, variables, and constants contained in any function library that you might want to use.

    There are many header files in C programming language and there all header files have their own different functionalities…

    List of all header file of c language as below.

    List of header files in c language

    No. Name Description
    1 stdio.h Input/Output Functions
    2 conio.h console input/output
    3 assert.h Diagnostics Functions
    4 ctype.h Character Handling Functions
    5 cocale.h Localization Functions
    6 math.h Mathematics Functions
    7 setjmp.h Nonlocal Jump Functions
    8 signal.h Signal Handling Functions
    9 stdarg.h Variable Argument List Functions
    10 stdlib.h General Utility Functions
    11 string.h String Functions
    12 time.h Date and Time Functions
    13 complex.h A set of function for manipulating complex numbers
    14 stdalign.h For querying and specifying the alignment of objects
    15 errno.h For testing error codes
    16 locale.h Defines localization functions
    17 stdatomic.h For atomic operations on data shared between threads
    18 stdnoreturn.h For specifying non-returning functions
    19 uchar.h Types and functions for manipulating Unicode characters
    20 fenv.h A set of functions for controlling the floating-point environment
    21 wchar.h Defines wide string handling functions
    22 tgmath.h Type-generic mathematical functions
    23 stdarg.h Accessing a varying number of arguments passed to functions
    24 stdbool.h Defines a boolean data type


    You can download a pdf file from here:

    List of header files in c language pdf – v0.1

    List of header files in c language pdf -v0.0

    C Standard Library Functions

    There are lots of standard library functions available in C to perform a lot of tasks easily. In a library, the actual functionality is implemented. For example, when we use any mathematics function we include math.h header file but in actual some math library libm.lib, libmmd.lib contain the body of the function. The standard library functions are built-in functions in C programming to handle tasks such as mathematical computations, I/O processing, string handling can also declare your own functions either in the program or in an external file with the .h extension called a header file.

    Advantages of C Standard Library Functions

    • Performs a specific operation
    • To get the pre-defined output instead of writing our own code to get those outputs
    • Easy to use
    • The functions are portable
    • Create the most efficient code optimized for maximum performance
    • Save the development time

    Use Of Library Function To Find String Length

    Suppose, you want to find the length of any string.You can always write your own piece of code to the length of any string but, it takes the time. However, in C programming you can find the string length by using the strlen function which is defined under header file string.h

    #include <stdio.h>
    #include <string.h>
    int main()
        char c[20];
        printf("Enter string: ");
        printf("Length of string c = %d \n",strlen(c));
        return 0;


    Enter string: improgrammer
    Length of string c = 12 

    Classification of Library Functions

    1. C Input Output Functions – transfer data between the C program and standard input/output devices.
    2. C String Character Functions – String.h header file supports all the string functions in C language.
    3. C Time Date Localization Functions –  implementing date and time manipulation operations.
    4. C Dynamic Memory Allocation Functions – dynamic memory allocation defined as the process of allocating memory during program execution.

    C Input Output Functions

    Function Description
    scanf read character, string, numeric data from a keyboard
    printf print the “character, string, float, integer, octal and hexadecimal values” onto the output screen
    getchar reads a character from the terminal and returns it as an integer
    putchar displays the character passed to it on the screen
    gets reads a line from stdin(standard input) into the buffer
    puts writes the string str and a trailing newline to stdout.

    C String Character Functions

    Function Description
    strcat concatenate two strings.
    strchr string scanning operation.
    strcmp compare two strings.
    strcpy copy a string.
    strlen get string length.
    strncat concatenate one string with part of another.
    strncmp compare parts of two strings.

    C Time Date Localization Functions

    Function Description
    asctime time is converted into a string.
    clock get current system time
    ctime return string that contains date and time information
    difftime get the difference between two given times
    getdate get the CPU time
    gmtime shares the tm structure that contains date and time information (UTC)
    localtime shares the tm structure that contains date and time information(Local-Time)
    mktime interprets tm structure as calendar time
    setdate modify the system date
    strftime modify the actual time format
    time get current system time as the structure

    C Dynamic Memory Allocation Functions

    Function Description
    malloc Allocates requested size of bytes and returns a pointer first byte of allocated space
    calloc Allocates space for an array of elements initializes to zero and then returns a pointer to memory
    free deallocate the previously allocated space
    realloc Change the size of the previously allocated space


    Did You Know the Compilation Process Step for C Programming Language?

    Cheat Sheet for C Program Execution Steps
    Cheat Sheet for C Program Execution Steps

    See More: Linux Command Cheat Sheet

    Latest Articles

    More Recipes Like This