I need help optimizing the code below, it's been a while since I coded in C and something has changed since then.
Write a program that asks for a name that compares to those that it has as elements of a character array and greets or announces that she is "stranger".
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char who[110];
char names []="Sam John Tom Sophia Jane Mary ";
printf("Enter a name: ");
gets(who);
char *ptr=strstr(names, who);
printf("\n%s\n",who);
if (ptr != NULL)
{
printf("We know '%s'\n", who);
printf("Hello %s", who);
}
else
{
printf("We don`t know '%s'\n", who);
printf("%s is a STRANGER!!", who);
}
return 0;
}