totn C Functions

C Language: strchr function
(Search String for Character)

In the C Programming Language, the strchr function searches within the string pointed to by s for the character c. It returns a pointer to it.

Syntax

The syntax for the strchr function in the C Language is:

char *strchr(const char *s, int c);

Parameters or Arguments

s
A string (terminated by a null character).
c
The character to be found.

Returns

The strchr function returns a pointer to the first occurrence of the character c within the string pointed to by s. If c isn't found, it returns a null pointer.

Required Header

In the C Language, the required header for the strchr function is:

#include <string.h>

Applies To

In the C Language, the strchr function can be used in the following versions:

  • ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the strchr function:

See Also

Other C functions that are noteworthy when dealing with the strchr function: