Never use gets. Ever. Don't just listen to me - look at the man page for gets; I'll quote:
"BUGS: Never use gets. Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the buffer, it is extremely dangerous to use. It has been used to break computer security. Use fgets() instead."
Do what it says. And remember: C-style strings *must* be null terminated; any string-handling functions expect the null termination. That means you need one more character than the maximum number of characters you expect to be input. Use a 5-character array, use fgets, read in only 4 characters, and then set the last character to \0 just in case.
Hope this helps
