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


strchr

Search for an 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 *strchr(const char *s, int c);
Parameters:

Parameters for this facility are:

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

Remarks:

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

Return:

strchr() returns a pointer to the successfully located character. If it fails, strchr() returns a null pointer (NULL).

See Also:

"memchr"

"strrchr"

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

int main(void)
{
	static char s[] = "tree * tomato eggplant garlic";
	char *strptr;

	strptr = strchr(s, '*');
	puts(strptr);

	return 0;	
}

Output:
* tomato eggplant garlic


[ 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