File Inclusion

An external file containing functions or macro definations can be included as a part of a program so that we need not rewrite these functions or macro definations. This is achieved by the preprocessor directive

#include "filename"

Where filename is the name of the file containing the required definitions or functions. At this point, the preprocessor inserts the entire contents of the filename into the source code of the program. When the file name nae is included within the double quotation marks, the search for the file is made in the current directory and then in the standard directories. Alternatively the directory can take the form

#include <filename>

In this case, the file is only searched in the standard directories.

Include files can have #include directives in them. This is referred to as nested includes. The number of levels of nesting varies between compilers. However, the ANSI standard stipulates that at least eight nested inclusions will be available.



About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext