What will be the output of the following C code?
#include < stdio.h >
#define SYSTEM 20
int main()
{
int a = 20;
#if SYSTEM == a
printf(“HELLO “);
#endif
#if SYSTEM == 20
printf(“WORLD\n”);
#endif
}
a) HELLO
b) WORLD
c) HELLO WORLD
d) No Output
Answer: b
Related Posts
The #elif directive cannot appear after the preprocessor #else directive.
Conditional inclusion can be used for ___________
In a conditional inclusion, if the condition that comes after the if is true, then what will happen during compilation?
What will be the output of the following C code?
#include < stdio.h >
#define COLD
int main()
{
#ifdef COLD
printf(“COLD\t”);
#undef COLD
#endif
#ifdef COLD
printf(“HOT\t”);
#endif
}The “else if” in conditional inclusion is written by?
What is the advantage of #define over const?
What will be the output of the following C code?
#include < stdio.h >
int foo(int, int);
#define foo(x, y) x / y + x
int main()
{
int i = -6, j = 3;
printf(“%d “,foo(i + j, 3));
#undef foo
printf(“%d\n”,foo(i + j, 3));
}
int foo(int x, int y)
{
return x / y + x;
}
Join The Discussion