Mixing scanf() and fgets() is a bad idea. scanf() just loves leaving ununsed characters on the input stream, mostly just newlines.
This is a problem, because fgets() uses newlines to mark the end of a line of input.
Which leads to
Code:
scanf( "%s", name );
fgets( buff, sizeof buff, stdin ); // this is skipped
Kind of comments
Always (and exclusively) use fgets() for input, then deal with the buffer however you want.
Code:
fgets( buff, sizeof buff, stdin );
sscanf( buff, "%s", name );
fgets( buff, sizeof buff, stdin );