Eric Mitchell wrote:Why does this program crash every time I run it?
Simply, you should not be using memory that you did not allocate. Can you see why it may be an issue to put 10 characters into a space meant for 5 characters?
Programming in the C programming language requires you to be vigilant... You must be always thoughtful of memory management using such a language...
As already indicated you are violating memory access within your application by overwriting memory locations that was not designated causing undefined behaviour which in your case is a system crash...
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
a bit of art, as a gift, the permaculture playing cards