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.
Loading...
Related Quiz
- What is a pointer in C programming?
- When defining a bit field, the data type ________ is typically used.
- The function ________ in C changes the size of the memory block pointed to by a given pointer.
- What is the scope of a global variable in a C program?
- In C, a structure member with a specified width is known as a ________.