0
I get some error in basics of c
When I try to use this code in chapter I get error. What is problem? #include <stdio.h> int main() { char a[100]; gets(a); printf("You entered: %s", a); return 0; }
4 Respostas
+ 1
It is only a warning to let you know that using the gets() function is a security risk to your program. A malicious person can enter more characters than the array allows, overwriting the stack and redirecting the code.
The warning recommends replacing gets() with fgets(). In the case above, the line would look like this:
fgets(a, 100, stdin);
+ 1
Yes, apart from the security warning, the code is fine.
+ 1
OK thank you bro
0
Then code is correct only security warning I got