>char type;
>type = fgetc(stdin)
fgetc() doesn't return a char, it returns an int.
http://faq.cprogramming.com/cgi-bin/...&id=1043284351