Home / C/C++ / How does “#include” keyword work?

How does “#include” keyword work?

Have you ever wondered : 

.#include meaning ?

.what is “#include” keyword?

.How does #include work?

we will discuss it.


# : is a pound sign which helps to pre-process the program before the compilation

include : is a simple directive that tells pre-processor to include the library’s data(i.e. function declarations)

  • HOW TO USE ?

in fact,

 The content of “file-name” or “header” will be copy and paste at position using include keyword. We will add 2 examples to clearly.

example 1:

example 2:

  • Once-Only Headers

If a header file happens to be included twice, the compiler will process its contents twice and it will result in an error. The standard way to prevent this is to enclose the entire real contents of the file in a conditional, like this-


About admin

Check Also

Simulation Engine in SystemC

SystemC is applied to system-level modeling, architectural exploration, performance modeling, software development, functional verification, and …

Leave a Reply

Your email address will not be published. Required fields are marked *