What will be the output of the following C code?
#include <stdio.h>
int main()
{
FILE *fp;
char c;
int n = 0;
fp = fopen("newfile1.txt", "r");
while (!feof(fp))
{
c = getc(fp);
putc(c, stdout);
}
}
#include <stdio.h>
int main()
{
FILE *fp;
char c;
int n = 0;
fp = fopen("newfile1.txt", "r");
while (!feof(fp))
{
c = getc(fp);
putc(c, stdout);
}
}
A. Compilation error
B. Prints to the screen content of newfile1.txt completely
C. Prints to the screen some contents of newfile1.txt
D. None of the mentioned
Answer: Option D
Join The Discussion