InterviewSolution
| 1. |
Why is it usually a bad idea to use gets()? Suggest a workaround. |
|
Answer» The standard INPUT library gets() reads USER input till it encounters a new line character. However, it does not check on the size of the variable being provided by the user is under the maximum size of the DATA type which makes the system vulnerable to buffer overflow and the input being WRITTEN into memory where it isn’t supposed to. We, THEREFORE, use gets() to achieve the same with a restricted range of input
|
|