added ctype.h header file include for isprint() function, included braces for if statements to prevent dangling else blocks