Home
menubar
rss_feed

Previous Reference C++ Reference <cstring> Next Reference




C++ Reference: strrchr()





strrchr()


Declaration

char* strrchr(const char* kcpString, int iChar);

Description

This function returns a pointer to the last occurrence of "iChar" in the string "kcpString." If no occurrence is found, the function returns NULL.

Example

#include <cstdio>
#include <cstring>

int main()
{
    char caString[] = "XoaX.net";
    // Find the first 'e' inside of "XoaX.net"
    char* cpFound = strrchr(caString, 'e');
    printf("First e found at %i\n", (cpFound - caString));

    return 0;
}


Output:








Previous Reference C++ Reference <cstring> Next Reference




Home | Reference | Play Games! | Blog | Forum | Site Map | Contact Us


shadow bottom image