What are the differences between gets(str)
and scanf("%s", str)
where str is a character array? Can you please explain with example?
Asked
Active
Viewed 376 times
0
-
Possible duplicate of [What's the difference between gets and scanf?](https://stackoverflow.com/questions/26602608/whats-the-difference-between-gets-and-scanf) – Sarques Nov 29 '19 at 04:37
-
Here's one similarity: they're both dangerous, in that neither can avoid overflowing the array if there's more input than expected. – Steve Summit Nov 30 '19 at 17:17
1 Answers
0
The basic difference between scanf()
and gets()
can be seen here:
For more: https://www.geeksforgeeks.org/difference-between-scanf-and-gets-in-c/
Thanks.

Sarques
- 465
- 7
- 17