Why can I only handle files with pointer?

1

In the statement I always have to put

FILE *Arq;

If I put it without * it gives an error. What is the reason?

    
asked by anonymous 20.09.2018 / 21:24

1 answer

3

Because the data that the fopen() function returns is a pointer, then you have to declare the variable with a compatible type. If it returned something else it would be this that you have to declare in the variable that will support the object that will handle the manipulation of the file. See documentation .

You could question the reason for it returning pointer. It is a complex object that has information in an area outside the stack , until even managed by the operating system, then indirectly is the only option.

    
20.09.2018 / 21:46