Header files in C programming

H

Operations more often used in C programming are implemented in standard or predefined functions found in the standard C library.

Prototypes of standard functions, as well as other types and symbolic statement statements required to use the functions, are found in header files.

These are common text files with the .h extension (from the header) and are usually stored in \TC\INCLUDE.

This directory must be set by the user in the Option/Directories/Include directories menu. Otherwise, the header files will not be able to be appropriately located in the compilation phase. Header files contain a collection of function statements, grouped by the functionality they offer. When we include a header file (.h) in a source file (.c), the compiler will know all the signatures of the functions it needs and will be able to generate the object code for each source file individually. It makes no sense to include a .c file in another .c file; two object files will be generated that will contain common definitions, and so a name conflict will occur when editing links. However, in order to create an executable file, each function must be defined.

The publisher of links does this; in other words, each function used in the program must be contained in the executable file. It searches the program’s object files for the function definitions each call function needs and builds a single executable file that contains all of this information. Libraries are special object files, the only purpose of which is to contain the definitions of the functions provided by the compiler to be integrated into the executable by the link editor.

The most important ANSI standard header files are:

alloc.h – declare allocation, editing and memory release functions;

assert.h – defines the assert () macro that is used to diagnose bugs in the program

bios.h – contains function definitions for peripheral equipment verification and for direct BIOS services calling;

conio.h – defines video functions for working with the console: displaying texts, controlling windows, positioning the cursor, controlling writing attributes, etc.;

ctype.h – contains functions for converting and classifying character codes;

dir.h – defines functions for working in directories and MS-DOS file specifications;

errno.h – defines symbolic constants with MS-DOS error codes;

graphics.h – contains graphical functions: color palette setting; Drawing lines, rectangles, curves, filling sections; saving, restoring video;

io.h – contains I / O functions for lower file processing;

math.h – defines most of the usual mathematical functions as well as those of the most important mathematical constants;

mem.h – contains functions for copying memory areas, searching, matching strings;

signal.h – defines the signals and functions needed to debug the program;

stdarg.g – defines macros and functions that allow working with variable argument functions;

stdio.h – contains keyboard / console input / output functions as well as functions for file-to-file processing;

stdlib.h – defines types, macros, and general functions: sorting, conversions, memory allocation, random number generation, environmental communication, etc .;

string.h – contains functions that allow the processing of strings;

time.h – defines functions for fixing and obtaining system time.

About the author

Ilias spiros
By Ilias spiros

Recent Posts

Archives

Categories