1.

What will be the output of the following C code?
 #include <stdio.h>
int main()
{
char ch;
int k = 0;
FILE *file;
file = fopen("Example.txt", "w+");
fprintf(file, "%c", 'I');
fprintf(file, "%c", -1);
fprintf(file, "%c", 'L');
fclose(file);
file = fopen("Example.txt", "r");
while ((ch = fgetc(file)) != -1)
printf("%c", ch);
return 0;
}

A. I
B. -1
C. L
D. Compilation Error
E. None of these
Answer» B. -1


Discussion

No Comment Found

Related MCQs