What will be the output of the following C code?
#include < stdio.h >
static int x = 5;
void main()
{
int x = 9;
{
x = 4;
}
printf(“%d”, x);
}
a) 9
b) 5
c) 4
d) 0
Answer: c
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 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
}What is the advantage of #define over const?
Join The Discussion