In the statement I always have to put
FILE *Arq;
If I put it without * it gives an error. What is the reason?
In the statement I always have to put
FILE *Arq;
If I put it without * it gives an error. What is the reason?
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.