What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 1;
int y = x == 1 ? getchar(): 2;
printf("%d\n", y);
}
#include <stdio.h>
int main()
{
int x = 1;
int y = x == 1 ? getchar(): 2;
printf("%d\n", y);
}
A. Compile time error
B. Whatever character getchar function returns
C. Ascii value of character getchar function returns
D. 2
Answer: Option C
Join The Discussion