Vidyalelo
C Programming · Q292

File Input Output

Programming · C Programming · question 292

Q292

What will be the output of the following C code? #include #include int main() char line[3]; FILE *fp; fp = fopen("newfile.txt", "r"); while (fgets(line, 3, fp)) fputs(line, stdout); return 0;

A.
Compilation error
B.
Infinite loop
C.
Segmentation fault
Answer
D.
No.of lines present in file newfile

Answer: Option C

Solution

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