Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why there is no semicolons after preprocessor directives?

Tags:

c

If I write

#include <stdio.h>;

there no error but a warning comes out during compilation

pari.c:1:18: warning: extra tokens at end of #include directive

What is the reason ?

like image 754
Parikshita Avatar asked Dec 03 '22 04:12

Parikshita


1 Answers

The reason is that preprocessor directives don't use semicolons. This is because they use a line break to delimit statements. This means that you cannot have multiple directives per line:

#define ABC #define DEF // illegal

But you can have one on multiple lines by ending each line (except the last) with a \ (or /, I forget).

like image 128
Alexander Rafferty Avatar answered Dec 21 '22 10:12

Alexander Rafferty