Friday, 2020-07-10, 4:12 AM

Learn SEO And Save The Earth

Tag Board
Our poll
Rate my site
Total of answers: 3

Total online: 1
Guests: 1
Users: 0
Login form

Header Files


A header file contains forward declarations of functions and variables. Every external function will be mentioned in a header file, including libraries that are pre-compiled into object code, and source files required to build the C program.

Standard Header Files

Set of libraries for additional functionality. We place references to these at the start of the source code file that uses one or more functions from that library.

Example: The compiler can compile the source code below, thanks to the #include line, which tells it where the definition of printf can be found.

#include <stdio.h>
void main ( void ) // Entry point function
printf("Hello World"); // Output

User Defined Header Files

When the programmer has functions that provide additional capabilities, then they might want to create a separate source code file to contain these functions.

Example: The quotes surrounding MyOutput.h are required to tell the compiler not to look along the standard library path, but to look in the same path as the source file. Also PrintNicely() function has

#include "MyOutput.h" // My output functions
void main ( void ) // Entry point function
PrintNicely ("Hello World"); // Output
«  July 2020  »