Input / Output - Programming

Q1:

Which of the following statement is correct about the program?
#include<stdio.h>

int main()
{
    FILE *fp;
    char ch;
    int i=1;
    fp = fopen('myfile.c', 'r');
    while((ch=getc(fp))!=EOF)
    {
        if(ch == '\n')
            i++;
    }
    fclose(fp);
    return 0;
}

A Error: in unsigned char declaration

B Error: while statement

C No error

D It prints all characters in file "trial"

ANS:A - Error: in unsigned char declaration

Here, EOF is -1. As 'ch' is declared as unsigned char it cannot deal with any negative value.