Well, it could be because you haven't declared name anywhere. Did you read your compiler errors?
Code:
itsme@dreams:~/C$ cat noname.c
#include <stdio.h>
main()
{
printf("Hello, what is your name?");
fgets(name, sizeof name, stdin);
printf("Your name is %s", name);
}
itsme@dreams:~/C$ gcc -Wall noname.c -o noname
noname.c:4: warning: return-type defaults to `int'
noname.c: In function `main':
noname.c:6: `name' undeclared (first use in this function)
noname.c:6: (Each undeclared identifier is reported only once
noname.c:6: for each function it appears in.)
noname.c:8: warning: control reaches end of non-void function
itsme@dreams:~/C$
Check out the lines I bolded.