strrchr

 

Description

Scan a string for the last occurrence of a character

Syntax

LPSTR strrchr( LPCSTR lpcszStr, int cc )

Parameters

lpcszStr
[input] Null terminated source string
cc
[input]Character to be located

Return

Returns a pointer to the last occurrence of a character in a string.

Examples

EX1

void strrchr_ex1()
{
    char str1[] = "I saw 3 blind mice";
    char* pdest = strrchr(str1,'i');
    if(pdest)
        printf("find the occurrence place \"%s\"\n" , pdest); // output ice
    else
        printf("scan failed \n");
}

Remark

See Also

strpbrk

header to Include

origin.h

Reference