implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration] gets(str);
时间: 2023-11-15 09:34:57 浏览: 53
This warning message is indicating that the function `gets()` has been used without being declared explicitly in the code. This could cause issues during compilation or execution of the program.
The warning message is suggesting to use the function `fgets()` instead, which is a safer alternative to `gets()`. `fgets()` takes an additional parameter specifying the maximum number of characters to read, which helps prevent buffer overflows.
To fix this warning, replace the line `gets(str);` with `fgets(str, sizeof(str), stdin);` where `str` is the character array to store the input and `stdin` is the standard input stream. This will ensure that the input is read safely and without any buffer overflows.
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)