What will be the output of the following C code?
#include
#define hello
main()
{
#ifdef hello
#define hi 4
#else
#define hi 5
#endif
printf("%d",hi);
}
Answer: A
The code shown above illustrates #define, #ifdef, #else, #endif. Since the identifier hello is defined (condition of #if is true), another identifier names hi is defined and it’s value is 4. If hello was not defined, then the value of hi would be 5.