Why is it usually a bad idea to use gets()? Suggest a workaround.
The function gets() reads characters from the stdin and stores them at the provided input buffer. However, gets() will keep reading until it encounters a newline character. Unless the buffer is large enough, or the length of the line being read is known ahead of time, gets() can potentially overflow the input buffer and start overwriting memory it is not supposed to, wreaking havoc or opening security vulnerabilities.
Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between int main and void main in c?
What is the real difference between arrays and pointers?
27 Answers Hexaware, Logic Pro, TCS,
How can I invoke another program from within a C program?
how we do lcm of two no using c simple if while or for statement
What is auto keyword in c?
When can you use a pointer with a function?
What are the advantages of the functions?
Why c is faster than c++?
Explain how can I convert a number to a string?
write a program to print the one dimensional array.
to find out the reverse digit of a given number
6 Answers Infosys, Microsoft, TCS, Wipro,
What is function what are the types of function?