Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
rindex - get last occurrence of character in string
&pagelevel(4)&pagelevel
Syntax | #include <string.h> char *rindex(const char *s, int c); |
Description | see strrchr() .
rindex() searches for the last 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 (last) position of c in string s, if successful. Null pointer if c is not contained in string s. |
Notes | index() and strrchr() are equivalent.
In BS2000, as in many other operating systems, you cannot use the null pointer to denote a null string. In this case a null pointer is an error and causes the process to abort. If you want to specify a null string, you must use a pointer which points to an explicit null string. With some implementations of the C programming language on many computers, a null pointer, when de-referenced, would result in a null string; this trick, which is portable only in very few cases, has been used in some programs. Programmers who use a null pointer to point to an empty string should be aware of this portability question; even with machines on which de-referencing a null pointer does not cause the program to abort, it need not necessarily result in a null string. The moving of characters is performed differently in different implementations. Overlapping can therefore lead to unpredictable results. |
See also | index() , strchr() , strrchr() .
|