Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 3
"A safer alternative to gets() is fgets(), which reads up to a specified number of characters. This approach helps prevent a buffer overflow, which happens when the string array isn't big enough for the typed text."
I think this is the reason because when using "gets()", the size of the string you input may be larger than the capacity of the array, which will cause the error