0

I have an array of characters. I am trying to find "houston". The only way I can think of to do this is to use a for loop and check each individual character. Is there an easier way to do this?

char string[] = "Fishing tourism miami atlanta dallas houston";
2
Contributors
4
Replies
21
Views
3 Years
Discussion Span
Last Post by COKEDUDE
0

This did what I want.

char *pch;
char string[] = "Fishing tourism miami atlanta dallas houston";
pch = strstr (string,"houston");
if(pch != NULL && start_flag != 1)
{
    //Do Work
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.