In 7th Edition UNIX™, there were two functions index() and rindex() that are respectively equivalent to the standard C functions strchr() and strrchr(), give or take const (which didn't exist when those functions were defined, any more than prototypes existed; there wasn't even C with Classes back then).

You're running foul of the backwards-compatible declarations of the function rindex(). The names index() and rindex() are archaic, but you can't use them blithely in your own code. Choose a different function name.

Answer from Jonathan Leffler on Stack Overflow
🌐
Linux Man Pages
linux.die.net › man › 3 › rindex
rindex(3): locate char in string - Linux man page
The index() function returns a pointer to the first occurrence of the character c in the string s. The rindex() function returns a pointer to the last occurrence of the character c in the string s.
🌐
Qnx
qnx.com › developers › docs › 6.5.0 › topic › com.qnx.doc.neutrino_lib_ref › r › rindex.html
rindex
Use the -l c option to qcc to link against this library. This library is usually included automatically. The rindex() function returns a pointer to the last occurrence of the character c in the string s.
🌐
MKSSoftware
mkssoftware.com › docs › man3 › rindex.3.asp
rindex() -- search for character in string
Is the character to search for. ... rindex() returns a pointer to the last occurrence of character c in string s.
🌐
Lemoda
nxmnpg.lemoda.net › 3 › rindex
rindex(3) manual page
The terminating null character is considered part of the string; therefore if c is ‘\0’, the functions locate the terminating ‘\0’. The rindex() function is identical to index(), except it locates the last occurrence of c.
🌐
The Open Group
pubs.opengroup.org › onlinepubs › 009695399 › functions › rindex.html
rindex
The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition Copyright © 2001-2004 The IEEE and The Open Group, All Rights reserved. ... The rindex() function shall be equivalent to strrchr().
🌐
IBM
ibm.com › docs › SSLTBW_2.4.0 › com.ibm.zos.v2r4.bpxbd00 › rrindx.htm
rindex() — Search for character - IBM Documentation
June 25, 2021 - If successful, rindex() returns a pointer to the first occurrence of c (converted to an unsigned character) in the string pointed to by string.
Find elsewhere
🌐
NetBSD
man.netbsd.org › rindex.3
rindex(3) - NetBSD Manual Pages
RINDEX(3) NetBSD Library Functions ... char * rindex(const char *s, int c); DESCRIPTION The rindex() function locates the last character matching c (converted to a char) in the nul-terminated string s....
🌐
CS50
manual.cs50.io › 3 › rindex
rindex - CS50 Manual Pages
index, rindex - locate character in string · Standard C library (libc, -lc) #include <strings.h> [[deprecated]] char *index(const char *s, int c); [[deprecated]] char *rindex(const char *s, int c); index() is identical to strchr(3). rindex() is identical to strrchr(3).
🌐
Linux Man Pages
man7.org › linux › man-pages › man3 › rindex.3.html
index(3) - Linux manual page
November 1, 2020 - index, rindex - locate character in string · Standard C library (libc, -lc) #include <strings.h> [[deprecated]] char *index(const char *s, int c); [[deprecated]] char *rindex(const char *s, int c); index() is identical to strchr(3). rindex() is identical to strrchr(3).
🌐
Polytechnique
lix.polytechnique.fr › ~liberti › public › computing › prog › c › C › MAN › index.htm
index - LIX
The index() function returns a pointer to the first occur- rence of the character c in the string s. The rindex() function returns a pointer to the last occur- rence of the character c in the string s.
🌐
Manpagez
manpagez.com › man › 3 › rindex
man page rindex section 3
The rindex() function locates the last character matching c (converted to a char) in the null-terminated string s.
🌐
FreeBSD
man.freebsd.org › cgi › man.cgi
rindex(3)
INDEX(3) Library Functions Manual INDEX(3) NAME index, rindex -- locate character in string LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include <strings.h> char * index(const char *s, int c); char * rindex(const char *s, int c); DESCRIPTION The index() function locates the first occurrence ...
🌐
Oracle
docs.oracle.com › cd › E88353_01 › html › E37843 › rindex-3c.html
rindex - man pages section 3: Basic Library Functions
February 9, 2022 - The rindex() function returns a pointer to the last occurrence of character c in string s.
🌐
R Project
search.r-project.org › CRAN › refmans › dynpred › html › cindex.html
R: Calculate Harrell's c-index
data(ova) cindex(Surv(tyears, d) ~ Karn + Broders + FIGO + Ascites + Diam, data = ova)
🌐
Hexmos
hexmos.com › freedevtools › man-pages › library-functions › string-examination › index-rindex
index, rindex - locate character in string - Manual Page | Free DevTools by Hexmos
Standard C library ( libc, -lc) index, rindex - locate character in string · strchr(3), strrchr(3) Linux man-pages 6.9.1 2024-05-02 · index(3) None. #include<strings.h>[[deprecated]]char*index(constchar* s,int · c);[[deprecated]]char*rindex(constchar* s,int ·
🌐
GitHub
github.com › eblot › newlib › blob › master › newlib › libc › string › rindex.c
newlib/newlib/libc/string/rindex.c at master · eblot/newlib
Sourceware.org's Newlib mirror with clang support for ARM baremetal - newlib/newlib/libc/string/rindex.c at master · eblot/newlib
Author: eblot
🌐
W3Schools
w3schools.com › python › ref_string_rindex.asp
Python String rindex() Method
Python Examples Python Compiler ... Plan Python Interview Q&A Python Training ... The rindex() method finds the last occurrence of the specified value....
🌐
RDocumentation
rdocumentation.org › packages › intsurv › versions › 0.2.2 › topics › cIndex
cIndex function - RDocumentation
In the context of survival analysis, the risk scores of a comparable pair are said to be concordant with the survival outcomes if \(r_i>r_j\). The C-index is defined as the proportion of the concordant pairs among the comparable pairs.