+ 1

Why gets donot work in sololearn

I am learning c whenever I use gets function it gives me a error.

17th Aug 2020, 4:49 AM
Aryan Aggarwal
Aryan Aggarwal - avatar
2 Respostas
+ 2
That's because gets() is not a standard function and has been removed from C/C++ latest standards because of its dangerous behaviour of overflowing the buffer. You should use fgets() as an alternative Learn more about fgets () here👇 https://www.educative.io/edpresso/how-to-use-the-fgets-function-in-c
17th Aug 2020, 5:23 AM
Arsenic
Arsenic - avatar
+ 2
gets() has been removed from the latest version of c standard .Sololearn in based on c latest compiler. You can use this get a string with gaps: scanf ("%[^\n]%*c", string);
17th Aug 2020, 5:25 AM
The future is now thanks to science
The future is now thanks to science - avatar