If I have a some pre-defined string names array such as
char *pet_names[] = {
"Dog",
"Cat"
};
and I want to prompt the user to enter an Animal name such as
printf("Enter a type of Animal ");
gets(Animal)
I want to be able to compare the inputed animal name to the above predefined names and set that to an integer value. Say if the user enters in Dog. I want to set Animal to 0, if the user enters in Cat, I want to set Animal to 1 and so on. How would I code this?? Any help would be appreciated.