[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


strrchr

Searches a string for the last occurrence of a character.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <string.h>
char *strrchr(const char *s, int c);
Parameters:

Parameters for this facility are:

s  
const char *  
The string to search  
c  
int  
A character to search for  

Remarks:

The strrchr() function searches for the last occurrence of c in the character array pointed to by s. The s argument must point to a null terminated character array.

Return:

strrchr() returns a pointer to the character found or returns a null pointer (NULL) if it fails.

See Also:

"memchr"

"strchr"

Example of strrchr() usage.:
#include <string.h>
#include <stdio.h>

int main(void)
{
	static char s[] = "Marvin Melany Metrowerks";
	puts(strrchr(s, 'M'));

	return 0;
}

Output:
Metrowerks


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000