File Inclusive Directives >> C Preprocessor Directives



File Inclusive Directives

  1. File inclusive Directories are used to include user define header file inside C Program.
  2. File inclusive directory checks included header file inside same directory (if path is not mentioned).
  3. File inclusive directives begins with #include
  4. If Path is mentioned then it will include that header file into current scope.
  5. Instead of using triangular brackets we use “Double Quote” for inclusion of user defined header file.
  6. It instructs the compiler to include all specified files.

Ways of including header file

way 1 : Including Standard Header Files

#include<filename>
  • Search File in Standard Library

way 2 :User Defined Header Files are written in this way

#include"FILENAME"
  • Search File in Current Library
  • If not found , Search File in Standard Library
  • User defined header files are written in this format

Live Example :

#include<stdio.h>     // Standard Header File
#include<conio.h>     // Standard Header File
#include"myfunc.h"    // User Defined Header File

Explanation :

  1. In order to include user defined header file inside C Program , we must have to create one user defined header file. [Learn How to Create User Defined Header File]
  2. Using double quotes include user defined header file inside Current C Program.
  3. “myfunc.h” is user defined header file .
  4. We can combine all our user defined functions inside header file and can include header file whenever require.