Sail E0 Webinar
Question


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;
}
Options:
A .  No error, No output.
B .  Program crashes at run time.
C .  Output: Unable to open file.
D .  None of above
Answer: Option C

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




Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers