In C, what happens if you attempt to open a file for reading using fopen() but the file does not exist?
- fopen() returns NULL, indicating that the file does not exist.
- fopen() raises an exception.
- fopen() creates a new file with the specified name.
- fopen() prompts the user to enter the correct file name.
The correct option is "fopen() returns NULL, indicating that the file does not exist." If the file does not exist or cannot be opened for some reason, fopen() returns a NULL pointer, indicating an error in opening the file.
Loading...
Related Quiz
- Which operator is used to access the value stored at the address specified by a pointer?
- You're developing a text editor and need to implement a search feature. Which function could be useful to check if a certain word exists in a text?
- How can you determine if you have reached the end of a file while reading it in C?
- What is the main purpose of using pointers in a C program?
- What considerations should be taken into account when using nested loops?