matsp's suggestion is probably best, especially if you have over, say, five strings. It's pretty easy to do, too.
Code:
/*! Returns true if \a needle is a fruit.
\param a The string that might represent a fruit.
\return True (nonzero) if \a needle is a fruit.
*/
int match(const char *needle) {
const char *haystack[] = {
"apple", "banana", "pear", /* ... */
}
size_t x;
for(x = 0; x < sizeof(haystack) / sizeof(*haystack); x ++) {
if(!strcmp(needle, haystack[x])) return 1;
}
return 0;
}
Plus, if you get a lot of strings, you can sort them and use a binary search instead of a linear search quite easily.