Keil Logo


#include <string.h>

unsigned char *strchr (
  const unsigned char *string,  /* string to search */
  char c);                      /* character to find */

The strchr function searches string for the first occurrence of c. The null character terminating string is included in the search.

Return Value

The strchr function returns a pointer to the first occurrence of character c in string or a null pointer if no matching character is found.

See Also

strcspn, strpbrk, strpos, strrchr, strrpbrk, strrpos, strspn

#include <string.h>
#include <stdio.h> /* for printf */

void tst_strchr (void) {

  unsigned char *s;
  unsigned char buf [] = "This is a test";

  s = strchr (buf, 't');

  if (s != NULL)
    printf ("found a 't' at %s\n", s);
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.