"warning: the `gets' function is dangerous and should not be used" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

"warning: the `gets' function is dangerous and should not be used"

I tried the second example in https://www.sololearn.com/Play/C: #include <stdio.h> int main() { char a[100]; gets(a); printf("You entered: "); puts(a); return 0; } But this is all I got back: You entered: yhchc ./Playground/file0.c: In function 'main': ./Playground/file0.c:6:3: warning: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 6 | gets(a); | ^~~~ | fgets ../Playground/: /tmp/cc3atX1G.o: in function `main': file0.c:(.text+0x15): warning: the `gets' function is dangerous and should not be used.

1st May 2020, 11:56 AM
Steve
Steve - avatar
1 Answer
0
Yeah we should always (not always😁)use" post"
1st May 2020, 12:01 PM
Mohammad Sohayb
Mohammad Sohayb - avatar