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.

  • DESCRIPTION

#: 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 clarify.

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-

__FreeSourceC.com__

About admin

Check Also

[ SC Tutorial ] 3. SystemC Data types

SystemC có một số kiểu dữ liệu được xác định trước để hỗ trợ các …

Leave a Reply

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