What is #include in c language and c++
#include is the preprocessor directive which includes both user and system header files.
It is used with following variant,
#include<file>
#include<file>
Above one is used for system header files.It will search for file in system directories and include it in your program.
#include"file"
This is used when we want to include our own(custom) header file we made before, in current program.It will search current directory on which your current working file to find file.If it is not found there then it will search it in system directories.
Below program is the example where we will include both system and user header files to do some string operation in c language.
---> system header file
#include<stdio.h>
#include<string.h> //system header file
main()
{
char n1="www",n2="engineerscur.com";
strcat(n1,n2); //which will combine n1 & n2
}
---> user header file
#include<stdio.h>
#include"str" //user header file
main()
{
char n1="www",n2="engineerscur.com";
s_combine(n1,n2); //which will combine n1 & n2
}
===>NOTE: you need to make first str header file.