Oh, and do use fgets. Particularly as we have to bear in mind that 20 characters is not always sufficient for all names.
would not work for example, as the null character is written outside the array, and when you print it, you will get garbage after the name.Code:"Sarah-Anne Wilkinson"
01234567890123456789
Using fgets() will prevent any overflow from causing problems with your program as such, which is a good start. Extending the name-space would also be a good idea - but if you don't want to do that, then at least make sure that it's not causing problems with your application to use names that are too long.
--
Mats