A file may be included by one of the following forms of preprocessor directive.
- The line containing the #include is replaced by the contents of the specified file.
- The difference between the first two forms of #include is implementation
dependent. Typically, the former style searches for a file in the current directory
then searches for the file in the directories listed in the include environment variable.
When the file name is a quoted string (the second form), the search for the file is restricted
to the current directory.
- When the file name is of the first form (i.e. delimited by < and >), it may
not contain any of the characters ',",/,/* or //. When the file name is a quoted
string (the second form), it may not contain the characters ',/,/*,//.
- When the third form of file inclusion (i.e. containing a token string) is
specified, the token string is treated as normal text (i.e. subject to
macro substitutions). The third form must reduce
to one of the previous two forms.
- The directive #include may appear in a file that was included in the
compilation via another #include directive.
- A particular implementation may impose an upper limit on the level of nesting
encountered when including files (nesting of files meaning that files may include
other files which in turn may include other files etc).