The scanf("%u"
call reads up to the newline character, but leaves that character in the input stream. When you call your first fgets
, it just reads that newline character and gives you an empty string.
There are many ways to clear the input stream, in this case you could just add a dummy call to fgets
after your scanf
.