-
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;
}
-
- I
- -1
- L
- Compilation Error
- None of these
Correct Option: A
I