The function ________ can be unsafe to use as it does not check for buffer overflow while reading a string in C.

  • fgets
  • getchar
  • gets
  • scanf
The correct answer is fgets. gets is unsafe due to buffer overflow issues, scanf can be problematic when not used carefully, and getchar is used for character input, not strings. fgets is a safer choice for reading strings.
Add your answer
Loading...

Leave a comment

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