Input / Output

Q1:
Point out the error in the program?
#include<stdio.h>

/* Assume there is a file called 'file.c' in c:\tc directory. */
int main()
{
    FILE *fp;
    fp=fopen('c:\tc\file.c', 'r');    
    if(!fp) 
      printf('Unable to open file.');        

    fclose(fp);
    return 0;
}

A No error, No output.

B Program crashes at run time.

C Output: Unable to open file.

D None of above

ANS:A - No error, No output.

The path of file name must be given as "c:\\tc\file.c"



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.