.\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Chris Torek. .\" %sccs.include.redist.man% .\" .\" @(#)index.3 8.1 (Berkeley) 06/04/93 .\" .Dd .Dt INDEX 3 .Os .Sh NAME .Nm index .Nd locate character in string .Sh SYNOPSIS .Fd #include .Ft char * .Fn index "const char *s" "int c" .Sh DESCRIPTION The .Fn index function locates the first character matching .Fa c (converted to a .Em char ) in the null-terminated string .Fa s . .Sh RETURN VALUES A pointer to the character is returned if it is found; otherwise .Dv NULL is returned. If .Fa c is '\e0', .Fn index locates the terminating '\e0'. .Sh SEE ALSO .Xr memchr 3 , .Xr rindex 3 , .Xr strchr 3 , .Xr strcspn 3 , .Xr strpbrk 3 , .Xr strrchr 3 , .Xr strsep 3 , .Xr strspn 3 , .Xr strstr 3 , .Xr strtok 3 .Sh HISTORY A .Fn index function appeared in .At v6 .