How can you open a file for both reading and writing in C?

  • fopen("file.txt", "rw")
  • fopen("file.txt", "r+")
  • fopen("file.txt", "w+")
  • open("file.txt", "rw")
The correct option is b. fopen("file.txt", "r+"). This combination of mode flags in the fopen() function allows a file to be opened for both reading and writing, providing flexibility in file manipulation operations.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *