Examveda

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);
}

A. Compile time error

B. Whatever character getchar function returns

C. Ascii value of character getchar function returns

D. 2

Answer: Option C


This Question Belongs to C Program >> C Fundamentals

Join The Discussion

Related Questions on C Fundamentals