Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 |
both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <strings.h>
char *index(const char *string, int c);
The index() function locates the first occurrence of c (converted to an unsigned char) in the string pointed to by string. The character c can be the NULL character (\0); the ending NULL is included in the search.
The string argument to the function must contain a NULL character (\0) marking the end of the string.
The index() function is identical to strchr() — Search for character.
If successful, index() returns a pointer to the first occurrence of c (converted to an unsigned character) in the string pointed to by string.
If unsuccessful because c was not found, index() returns a NULL pointer.
There are no errno values defined.