The source file inclusion directive “include” tells the preprocessor to replace the directive with the contents of the file specified in the directive.
Three different ways,
#include<name-of-the-file
It searches the prespecified list of directories for the source file and text embeds the entire content of the source file in place of file itself
#include “name-of-file”
It first searches the file in the current working directory. If the search us not supported or if the search fails, the search will be carried out in the prespecified list of directories. If the search still fails, it will show the error “unable to include name of file”
#include token-sequence
Searches the file as in point 1 or in point 2 depending upon the form of the directive to which it matches after the preprocessing token sequence is processed.
Example
#define STR(x) #x
#include STR(stdio.h)
int main()
{
printf("Third form of source file inclusion");
return 0;
}
Output
Third form of source file inclusion
Views: 1