In C, semicolons (;
) are used to indicate the end of the statement. Why do #include
lines not need a semicolon?
#include
(and all other lines beginning with #
like #define
) is part of the preprocessor. This is actually a separate programs that runs before the main compiler and does things like include files into the source and macro expansion.
#include
is processed by the pre-processor and the compiler doesn't see these statements. Hence ;
is not required at the end of statement.
Because preprocessing directives are not statements.
Even not all statements are required to have a final ;
. For example:
int bla = 1;
if (bla) {
}
After the declaration of bla
we have two statements: one if
statement and one empty compound statement. There is no ;
but the program is valid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With