C Programming :: C Preprocessor - Discussion
Home > C Programming > C Preprocessor > MCQs Questions Discussion
1 / 34
What will be output of the following "c" code?
#include<stdio.h>
#define max(a,b) (a>b)? a:b
int main()
{
int a,b; a=3; b=4;
printf("%d",max(a,b));
return 0;
}
#include<stdio.h>
#define max(a,b) (a>b)? a:b
int main()
{
int a,b; a=3; b=4;
printf("%d",max(a,b));
return 0;
}
A3
B4
C12
D0
ECompilation Error
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
STEP-BY-STEP
Here we are request Compiler to print the maximum value between a & b i.e. 3 & 4.
printf("%d",max(a,b));
Answer= 4
Read Full Answer
Report Error
Please Login First Click Here
B is right answer becouse a>b condition is false so max in a,b is 4.
Read Full Answer
Report Error
Please Login First Click Here
STEP-BY-STEP
Since, using directive statement the valus of a is less than b which is false condition in the ternery statement results to B value.
Read Full Answer
Report Error
Please Login First Click Here
As I doesn't not mention any headerfiles it gives compilation error
Read Full Answer
Report Error
Please Login First Click Here