Loading...
Select Version
&pagelevel(4)&pagelevel
Definition | #include <string.h> char *index(const char *s, int c);
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. | |
Note Example | The Find the first ’f’: #include <string.h> #include <stdio.h> int main(void) { char *s = "What ffun in the sun!"; printf("%s\n", s); printf("Where is the error? %s\n", index(s, 'f')); return 0; } | |
See also | rindex, strchr |