strchr strrchr functions

The functions will return a pointer to the character or NULL if the character is not found.
Library:   string.h

Prototype: char * strchr(const char *string, int character);

Syntax:	   int character='w';
	   char *string="red dwarf";
           if(strchr(string, character)) puts("Character found");

See Also:

strstr which looks for a sub-string in a string.


index and rindex do the same as strchr and strrchr but are non standard.

Example program (from Dave Doolin).

Top Master Index Keywords Functions

Martin Leslie