Vidyalelo
C Programming · Q250

File Input Output

Programming · C Programming · question 250

Q250

What will be the output of the following C code? #include int main() int n; scanf("%d", &n); ungetc(n, stdin); scanf("%d", &n); printf("%d ", n); return 0;

A.
Compile time error
B.
Whatever is typed by the user first time
Answer
C.
Whatever is typed by the user second time
D.
Undefined behaviour

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board