#include int main(void){ char name[20]; void strip_newline( char *str, int size ) { int i; /* remove the null terminator */ for ( i = 0; i < size; ++i ) { if ( str[i] == '\n' ) { str[i] = '\0'; /* we're done, so just exit the function by returning */ return; } } /* if we get all the way to here, there must not have been a newline! */ } printf("What is your name?\n"); fgets(name, 20 , stdin); strip_newline( name, 20 ); if ( name == "Frank\n") { printf("Your name is %s!\n", name); } else { printf("I bet you wish your name was Frank!\n"); } return 0; }