C Programming - Input / Output - Discussion

3. 

What does fp point to in the program ?

#include<stdio.h>

int main()
{
    FILE *fp;
    fp=fopen("trial", "r");
    return 0;
}

[A]. The first character in the file
[B]. A structure which contains a char pointer which points to the first character of a file.
[C]. The name of the file.
[D]. The last character in the file.

Answer: Option B

Explanation:

The fp is a structure which contains a char pointer which points to the first character of a file.


Kushbu said: (Feb 4, 2011)  
The fp is a structure which contains a char pointer which points to the first character of a file.

Royal said: (Dec 30, 2012)  
FILE is a structure, can any one give me the FILE structure members?

Himanshu said: (Oct 15, 2014)  
But what does are of fopen ("trial", "r") mean?

Varsha said: (Oct 25, 2014)  
Why we use f or why we write printf?

What doesn't mean?

Madhu said: (Dec 10, 2014)  
@Himanshu.

Trail-name of the file.

R-reason of it's opening (read, write,...).

Vishu said: (Dec 16, 2016)  
@Himanshu.

fopen("trial","r") ---> here 'trial' is the name of the file and you open that file and reading the content of the file. That's all.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.