C Programming :: C Preprocessor - Discussion
Home > C Programming > C Preprocessor > MCQs Questions Discussion
30 / 34
What will be output of the following "c" code?
#include<stdio.h>
#define max(a,b) (a>b?b:a)
#define squre(x) x*x
int main()
{
int i = 2, j = 3, k = 1;
printf ("%d %d", max(i,j), squre(k));
return 0;
}
#include<stdio.h>
#define max(a,b) (a>b?b:a)
#define squre(x) x*x
int main()
{
int i = 2, j = 3, k = 1;
printf ("%d %d", max(i,j), squre(k));
return 0;
}
A2 1
B3 2
C3 1
D1 3
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
TRICK
Here, in max(i,j)=max(2,3) or #define max(2,3) we check 2>3? It is not correct so 'a' will be value which is 2 & In square(x)=x*x we will get k*K=1*1=1. So, the final value will be 2 1.
Read Full Answer
Report Error
Please Login First Click Here