+ 1
Gets
What us gets used for gets()
9 ответов
+ 6
Do NOT use the gets() function. It is unsafe and was removed from the standard a long time ago. When you use gets() the compiler gives you a warning also.
Instead use the fgets() function
https://www.cplusplus.com/reference/cstdio/fgets/
+ 3
@Martin Taylor
To be fair though, the SoloLearn course itself shows the gets() function without even mentioning that it is not a part of the standard anymore and that it should not be used. gets() function has literally been used a lot of times in the example codes throughout the course. What makes it worse is that fgets() isn't even mentioned once in the course. As the OP has completed only 7% of the C course on SoloLearn, I think they came to know about it from there.
+ 1
in which language?
+ 1
C
+ 1
gets() reads a line from stdin and stores it into the string pointed to by str.
+ 1
K
+ 1
Ok
0
In java get() and set() methods are used for private methods to set the value and print the value