Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Out of fgets() and gets() which function is safe to use and why in C Language?
Home
C Plus Plus
Out of fgets() and gets() which function is safe to use and why in C Language?
0
votes
asked
Mar 10, 2020
in
C Plus Plus
by
rahuljain1
Out of fgets() and gets() which function is safe to use and why in C Language?
#c-language-fgets
#c-language-gets
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Mar 10, 2020
by
SakshiSharma
fgets() is safer than gets(), because we can specify a maximum input length. Neither one is
completely safe, because the compiler can‘t prove that programmer won‘t overflow the buffer he
pass to fgets ().
Related questions
+1
vote
Q: In C, why is the void pointer useful in C Language? When would you use it in C Language?
asked
Mar 12, 2020
in
C Plus Plus
by
rahuljain1
#c-language-void-pointer
0
votes
Q: Why is it usually a bad idea to use gets()? Suggest a workaround.
asked
Jan 6
in
C Plus Plus
by
GeorgeBell
c_interview-questions-answers
0
votes
Q: Why is it necessary to give the size of an array in an array declaration in C Language?
asked
Mar 17, 2020
in
C Plus Plus
by
rajeshsharma
#c-language-array-of-array
0
votes
Q: What is a function in C Language?
asked
Mar 17, 2020
in
C Plus Plus
by
rajeshsharma
#c-language-functions
0
votes
Q: What is the use of printf() and scanf() functions in C Programming language?
asked
Jan 12
in
C Plus Plus
by
GeorgeBell
c-programming-questions-answers
0
votes
Q: Why doesn’t C support function overloading?
asked
Jan 4
in
C Plus Plus
by
GeorgeBell
c-interview-questions-answers
0
votes
Q: What are the ways to a null pointer that can use in the C programming language?
asked
Mar 17, 2020
in
C Plus Plus
by
SakshiSharma
#c-language-c-programming
0
votes
Q: What is a far pointer in C Language? Where we use it in C Language?
asked
Mar 12, 2020
in
C Plus Plus
by
rahuljain1
#c-language-pointer
0
votes
Q: What is the use of typedef in C Language?
asked
Mar 10, 2020
in
C Plus Plus
by
rahuljain1
#c-language-typedef
+1
vote
Q: Which one of the following statements correctly refers to the Delete and Delete[] in C++ programming language?
asked
Jan 21, 2021
in
C Plus Plus
by
SakshiSharma
#delete-function
#delete
...