main.c h1.h
------------------------- ------------------
/* Comments are OK */ int h1;
#define M 1 #include "h3.h"
#undef N
#line 10
#if F
int f(int); h2.h
#endif ------------------
#if STDIO int h2;
#include <stdio.h>
#endif
#include "h1.h"
/* Comments are OK */ h3.h
# ------------------
#include "h2.h" #ifndef H3_H
#include "h3.h" #define H3_H
main() { int h3;
} #endif
The initial sequence can vary, depending on whether any macros are defined on the command line.
| Macros defined | Resulting initial sequence |
| None | "h1.h",
"h2.h", "h3.h" |
| STDIO | <stdio.h>,
"h1.h", "h2.h", "h3.h" |
| F |
No initial sequence (because int f(int) occurs
before any include directives) |
Although h3.h is included twice (once in main.c and once in h1.c), only the first include is considered in the initial sequence, because the second include does not take effect.
![]()
Rules for Matching the Initial
Sequence