0

What are the differences between gets(str) and scanf("%s", str) where str is a character array? Can you please explain with example?

  • 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 Answers1

0

The basic difference between scanf() and gets() can be seen here:

enter image description here

For more: https://www.geeksforgeeks.org/difference-between-scanf-and-gets-in-c/

Thanks.

Sarques
  • 465
  • 7
  • 17