Originally Posted by
keira
You have to understand that user input is kept in a buffer called stdin. It is dynamic and resizes itself so you don't have to worry about making things fit into it. When you store 20 bytes (characters) of data into an array you are using a function to read 20 bytes from stdin and store them into the array. If you don't tell it to read 20 bytes (if you use a function like scanf() where the array size is not passed to the function, it will read bytes from stdin until it encounters a NULL or a byte represented in hex as 00 meaning the end of the string). If you understood nothing I just said, just remember to use fgets and specify the length of your array and you will never run into problems concerning overflow.