May the name of a macro parameter be a keyword?
c, keyword, macros
Solution
In this context, `int` is not a variable (more correct: parameter) name because of course `PRINT` is also not a function -- it's a preprocessor macro.
Whatever you write as part of a macro definition is only looked at by the preprocessor. By the time the compiler gets to see the processed source nothing remains of the `"int"` name.
This is similar to what happens with formal parameters of functions: the compiler gets to see those names, but after it's done with the source no trace of them remains in the compiled code (so you need to load debug symbols in the debugger to "get this information back").
Problem
I discovered something interesting while writing code. I defined a macro in my code and accidentally used the keyword `int` as the variable name of parameter of that macro. The code worked perfectly fine, but I’m a bit surprised about it. I have read that in C keywords are reserved words and cannot be used as variable names. This is my code: ``` #include <stdio.h> #define PRINT(int) printf("%d",int) int main() { int x=2; PRINT(x); return 0; } ``` Can anyone explain me why is it working fine? Is it not true that keywords are reserved and cannot be used as variable names in C, or is this some exception in C for macros?