What will be the output of the following C code? [code]#include<stdio.h> #define max 100 void main() { #if(max%10) printf("san");

Trường Phan

New member
What will be the output of the following C code?
Code:
#include<stdio.h>
#define max 100
void main()
{
    #if(max%10)
    printf("san");
    #endif
    printf("foundry");
}
A. error
B. san
C. foundry
D. 123hoidap
 
Answer: d
Explanation: The code shown above is an illustration of the preprocessor directive #if. The value of the defined identifier max is 100. On checking the condition (100510==), which is true, the statements after #if are executed till #endif is encountered. Hence the output is 123hoidap.
 

Tìm kiếm

Back
Top