Vidyalelo
C Programming · Q236

File Input Output

Programming · C Programming · question 236

Q236

What will be the output of the following C code if 2 characters is typed by the user? #include #include int main() char line[3]; fgets(line, 3, stdin); printf("%d ", line[2]); return 0;

A.
Compilation error
B.
Undefined behaviour
C.
0
Answer
D.
10(ascii value of newline character)

Answer: Option C

Solution

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