S Sơn Lê Member Sep 21, 2021 #1 What will be the output of the following C code? Code: #include<stdio.h> void f() { #define sf 100 printf("%d",sf); } int main() { #define sf 99; f(); printf("%d",sf); } A. error B. 100 C. 99 D. 10099
What will be the output of the following C code? Code: #include<stdio.h> void f() { #define sf 100 printf("%d",sf); } int main() { #define sf 99; f(); printf("%d",sf); } A. error B. 100 C. 99 D. 10099
T Trang Esther New member Sep 21, 2021 #2 Answer: a Explanation: Macro definition is global even if it is appears within the function scope. In this case the macro sf is defined in the function f(). Hence it results in a compile time error. Upvote 0 Downvote
Answer: a Explanation: Macro definition is global even if it is appears within the function scope. In this case the macro sf is defined in the function f(). Hence it results in a compile time error.