'What is the role of identifier in C preprocessor directives
When I execute the following code, the output is 5 6.
int main()
{
int one = 5, two = 6;
#ifdef next
one = 2;
two = 1;
#endif
printf("%d %d", one, two);
return 0;
}
Definitely the code within #ifdef #endif is not getting excuted.
I am unable to understand the utility of the identifier next. What is the keyword instead of next that will make the compiler execute the code inside the #ifdef #endif section?
Solution 1:[1]
You simply define the macro
#define next
int main()
{
int one = 5, two = 6;
#ifdef next
one = 2;
two = 1;
#endif
printf("%d %d", one, two);
return 0;
}
Now the values will change.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Irelia |
