File Inclusive Directives >> C Preprocessor Directives
File Inclusive Directives
- File inclusive Directories are used to include user define header file inside C Program.
- File inclusive directory checks included header file inside same directory (if path is not mentioned).
- File inclusive directives begins with #include
- If Path is mentioned then it will include that header file into current scope.
- Instead of using triangular brackets we use “Double Quote” for inclusion of user defined header file.
- 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 :
- 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]
- Using double quotes include user defined header file inside Current C Program.
- “myfunc.h” is user defined header file .
- We can combine all our user defined functions inside header file and can include header file whenever require.