Reputation:
Since we use 'include' and 'define' only after # in C, that too at the start of the program; do we still consider them as keywords? Can we declare variables called include or define?
int include, define;
Is this wrong? The thing is, it shouldn't be wrong according to me. I tried this out and it does not give me any errors. However, my university conducted a quiz in which they said that these 2 declarations are wrong.
Upvotes: 0
Views: 3185
Reputation: 48287
No Keywords but instead include
and define
are C Preprocessor Directives,
the C preprocessor modifies a source file before handing it over to the compiler, allowing conditional compilation with >#ifdef, defining constants with #define, including header files with #include, and using builtin macros such as FILE. >This page lists the preprocessor directives, or commands to the preprocessor, that are available:
There are another prepocessors...
Upvotes: 0
Reputation: 134356
As per the C11
specification, chapter §6.4.1, keywords, include
and define
does not appear in the reserved keywords list. So they are not keywords.
FWIW, the list of keywords, as it appears,
keyword: one of
auto ∗ break case char const continue default do double else enum extern float for goto if inline int long register restrict return short signed sizeof static struct switch typedef union unsigned void volatile while _Alignas _Alignof _Atomic _Bool _Complex _Generic _Imaginary _Noreturn _Static_assert _Thread_local
Upvotes: 1
Reputation: 41
No they are not Keywords like int,char,if,while,etc but they are pre-processors which begin with hash symbol "#".These pre-processors are used for linking,defining,etc purposes For more information u can refer, https://en.wikipedia.org/wiki/C_preprocessor
Upvotes: 0
Reputation: 37944
No, they are preprocessing directives like #line
or #error
. They are not considered as keywords. You can have pretty much variables like int line
or int error
.
Upvotes: 4