|
You are not using scanf in such a way as to prevent overrunning the buffer, which can lead to improper operation and crashing of your program. Your buffer, with a length of 30, can hold a 29-character string, maximum, since your string will require a terminating null if you intend to pass it to a C-string function such as printf or strlen. When you overwrite the terminating null that IS there with your plural ending, you're bound to get odd results, if not a memory violation, because you're not terminating your addition.
|