Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

index - get first occurrence of character in string

&pagelevel(4)&pagelevel

Syntax

#include <strings.h>

char *index(const char *s, int c);

 

Description

index() searches for the first occurrence of character c in string s and returns a pointer to
the located position in s if successful.

The terminating null byte (\0) is also treated as a character.

Return val.

Pointer to the position of c in string s,


if successful.

Null pointer

if c is not contained in string s.                    

Notes

index() and strchr() are equivalent.

Portable applications should use the strchr() function instead of index().

See also

rindex(), strchr(), strings.h.