|
CC78K0S Datasheet, PDF (240/520 Pages) NEC – C Compiler Ver.1.30 or Later Language | |||
|
◁ |
CHAPTER 10 LIBRARY FUNCTIONS
6-7 strchr
strrchr
Character String/Memory Functions
FUNCTION
The string function strchr returns a pointer to the first occurrence of a specified character in a string.
The string function strrchr returns a pointer to the last occurrence of a specified character in a string.
HEADER
string.h
FUNCTION PROTOTYPE
char *strchr (const char *s, int c);
char *strrchr (const char *s, int c);
Function
strchr,
strrchr
Arguments
s... Pointer to string to be
searched
c ... Character specified for
search
Return Value
⢠Pointer indicating the first or
last occurrence of c in string
s if c is found in s
⢠Null pointer if c is not found
in s
EXPLANATION
strchr
⢠The strchr function searches the string pointed to by s for the character specified by c and returns a pointer
to the first occurrence of c (converted to char type) in the string.
⢠The null terminator is regarded as part of the string.
⢠If the specified character is not found in the string, the function returns a null pointer.
strrchr
⢠The strrchr function searches the string pointed to by s for the character specified by c and returns a pointer
to the last occurrence of c (converted to char type) in the string.
⢠The null terminator is regarded as part of the string.
⢠If no match is found, the function returns a null pointer.
240
Userâs Manual U14872EJ1V0UM
|
▷ |