index

Autres langues

Langue: ja

Autres versions - même langue

Version: 1993-04-12 (fedora - 25/11/07)

Autres sections - même nom

Section: 3 (Bibliothèques de fonctions)

名前

index, rindex - 文字列中の文字の位置を示す

書式

 #include <strings.h>
 
 char *index(const char *s, int c);
 
 char *rindex(const char *s, int c);
 

説明

index() 関数は、文字列 s 中に最初に文字 c が 現れた位置へのポインタを返す。

rindex() 関数は、文字列 s 中に最後に文字 c が 現れた位置へのポインタを返す。

文字列を終端する NULL 文字は、文字列の一部とみなされる。

返り値

index() と rindex() 関数は、一致した文字へのポインタか、 もし文字が見つからない場合は NULL を返す。

準拠

4.3BSD; POSIX.1-2001 では「過去の名残 (LEGACY)」と位置付けられている。

関連項目

memchr(3), strchr(3), strpbrk(3), strrchr(3), strsep(3), strspn(3), strstr(3), strtok(3)