What will be the output of the following C code? [code]#include<stdio.h> #define INDIA 1 #define US 2 #define CC US main() { #if CC==INDIA

Nam Lê

Member
What will be the output of the following C code?
Code:
#include<stdio.h>
#define INDIA 1
#define US 2
#define CC US
main()
{
    #if CC==INDIA
    printf("Rupee");
    #elif CC==US
    printf("Dollar");
    #else
    printf("Euro");
    #endif 
}
A. Euro
B. Rupee
C. Dollar
D. Error
 
Answer: c
Explanation: The output of the code shown above is Dollar. Since the macro CC is defined as US at the beginning of the code, it satisfies the condition #elif(CC==US). Hence “Dollar” is printed.
 

Tìm kiếm

Back
Top