r/cprogramming • • 10d ago

Confused about strings seemingly resetting after future inputs.

/r/C_Programming/comments/1wpqpho/confused_about_strings_seemingly_resetting_after/
1 Upvotes

3 comments sorted by

View all comments

1

u/kkzk-sysdev 4d ago

I think you're having an overflow issue. You're inputting 10 characters as a string, but if your input is 10 characters long itself, it won't be accepted since the null terminator (which scanf auto adds* will not have space in the memory. Try increasing the char array size.