Vidyalelo
C Programming · Q121

File Input Output

Programming · C Programming · question 121

Q121

What will be the output of the following C code? #include #include int main() char line[3]; fgets(line, 3, stdin); printf("%d ", strlen(line)); return 0;

A.
3
B.
1
Answer
C.
Any length since line did not end with null character
D.
Depends on the standard

Answer: Option B

Solution

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