+ 2
gets() or fgets() in c ?
Hi friends, I wanted to know what is the difference between the two functions of gets() and fgets? Who knows?
3 Answers
+ 3
Thank you all.
+ 1
Morteza R.g gets() do not do any array bound testing thus is prone to buffer overflow which makes it dangerous to use in your program (just like Martin Taylor said)
Whereas on the other hand while using fgets() one has to to specify the maximum amount of characters to be read by it hence making it safer to use.