Why is it usually a bad idea to use gets()? Suggest a workaround.
Answer Posted / hrpynux@gmail.com
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 |
Post New Answer View All Answers
Why cant I open a file by its explicit path?
What are variables c?
What are pointers? What are different types of pointers?
How to declare pointer variables?
is it possible to create your own header files?
Explain 'bit masking'?
Explain c preprocessor?
How can I manipulate individual bits?
What is the use of a conditional inclusion statement in C?
How many levels of pointers have?
What are the benefits of organizational structure?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
What is double pointer in c?
Why is c called c?
Why do we need arrays in c?