File inclusion causes one file to be included in another.
What is the meaning of above syntax?
It is simply causes the entire contents of filename to be inserted into source code at that point in the program.
Why file inclusion is used?
If we have a very large program, the code is best divided into several different files, each containing a set of related functions. It is a good programming practice to keep different sections of a large program separate. These files are #included at the beginning of main program file.
There are some functions and some macro definitions that we need almost in all program that we write. These commonly needed functions and macro definitions can be stored in a file, and that file can be included in every program we write, which would add all the statements in this file to our program as if we have typed them in.
There are two way to write #include statement as:
1. #include "myfile.h"
This command would look for the file myfile.h in the current directory as well as the specified list of directories as mentioned in the include search path that might have been setup.
This command would look for the file myfile.h in the specified list of directories only.