use of gets() in c++(gcc 6.3)

I have coded on code blocks and the language I have used is c++ but when I compile in the code chef compiler by uploading the file gets() function shows up compilation error despite including the header file <stdio.h>.
error says gets() not declared;

Using the gets() function is dangerous, as it suffers from buffer overflow issue. You should refrain from using that.I guess you want take input with spaces there are some alternatives to gets() try them…

See the following link.

http://www.cplusplus.com/reference/cstdio/gets/

Under the heading Compatibility, it’s written that: The most recent revision of the C standard (2011) has definitively removed this function from its specification.

This could be the reason.

1 Like

If you want to take input with spaces try using getline.

Due to buffer overflow issue, gets is removed from cpp standards.Instead you can use fgets to fulfill your needs in your program. Hope will help you. For more details visit the following link.

//