What will be the output of the following C code? [code]#include<stdio.h> #define inline inline f(char a) { #ifdef inline

Mỹ Duyên

New member
What will be the output of the following C code?
Code:
#include<stdio.h>
#define inline
inline f(char a)
    {
        #ifdef inline
        printf("%c",a);
        #endif 
    }
main()
{
    f('a');
}
A. Error
B. a
C. No error but nothing will be printed as output
D. 97
 
Answer: b
Explanation: In the code shown above, we have defined identifier names inline using the macro #define. The output will be printed only if inline is defined. Since it is defined, ‘a’ is printed as output.
 

Tìm kiếm

Back
Top