What will be the output of the following C code? [code]#define display(a) #a main() { printf(display("56#7")); }[/code]

What will be the output of the following C code?
Code:
#define display(a) #a
main()
{
    printf(display("56#7"));
}
A. Error
B. “56#7”
C. 56#7
D. 567
 
Answer: b
Explanation: In this case, it is not necessary for the argument in the printf function to be enclosed in double quotes. However, if the argument is enclosed in double quotes, no error is thrown. The output of the code shown will be “56#7”.
 

Tìm kiếm

Back
Top