Home » C Programming » Data Types » Question
  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;
    }
    1. I
    2. -1
    3. L
    4. Compilation Error
    5. None of these
Correct Option: A

I



Your comments will be displayed only after manual approval.