Which mode should be used with fopen to open a file for both reading and writing?
- "a+"
- "r+"
- "rb+"
- "w+"
To open a file for both reading and writing in C, you should use the "r+" mode with the fopen function. This mode allows you to perform both read and write operations on the file.
Loading...
Related Quiz
- What happens when you perform pointer arithmetic on a pointer to a data type other than 'char'?
- In C, subtracting two pointers that point to elements of the same array yields a result of type ________.
- How are strings typically terminated in C?
- Which function is used to close a file that has been opened for reading or writing?
- The function ________ is used to write data to a binary file.