Examveda

What will be the output of the following C code?
#include <stdio.h>
#include <string.h>
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

D. No.of lines present in file newfile

Answer: Option C


This Question Belongs to C Program >> File Input Output

Join The Discussion

Related Questions on File Input Output