#ifdef something
int some=0;
#endif
main()
{
int thing = 0;
printf("%d %d\n", some ,thing);
}
Answer:
Compiler error : undefined symbol some
Explanation:
This is a very simple example for conditional compilation. The
name something is not already known to the compiler making the
declaration
int some = 0;
effectively removed from the source code.
#if something == 0
int some=0;
#endif
main()
{
int thing = 0;
printf("%d %d\n", some ,thing);
}
Answer
0 0
Explanation
This code is to show that preprocessor expressions are not the
same as the ordinary expressions. If a name is not known the
preprocessor treats it to be equal to zero.
0 comments:
Post a Comment