+ 5

Related to string

Why Sololearn's Compiler didn't support gets function in string ???

26th Jan 2020, 4:56 PM
Rohit Upadhyay
Rohit Upadhyay - avatar
4 Answers
+ 3
It works but it gives warning what may happen with using gets. Warning comes into reality when your input causing overflowing charecters and unexpected output comes. All these because, gets is not from standard c documention... Edit: hence not recommended to use.
26th Jan 2020, 5:44 PM
Jayakrishna 🇼🇳
+ 2
It would be nice if you can probably share an example and explain the problem.
26th Jan 2020, 4:58 PM
Avinesh
Avinesh - avatar
+ 1
"gets" does work, but you get some ugly warning messages. You need to use "fgets":- http://www.cplusplus.com/reference/cstdio/fgets/
26th Jan 2020, 5:43 PM
rodwynnejones
rodwynnejones - avatar
0
There is quite a good reason why `gets` is no longer recommended. Searched the net for "gets is deprecated" and found these two of on the top results https://bytes.com/topic/c/answers/737528-why-usage-gets-dangerous https://stackoverflow.com/questions/1694036/why-is-the-gets-function-so-dangerous-that-it-should-not-be-used
26th Jan 2020, 6:21 PM
Ipang