count_char()

count_char()#

The function count_char() counts the occurrences of a specified character in a given string.

Prototype

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

Parameters

Key

Type

Description

s

const char *

The input string in which occurrences of c will be counted.

c

char

The character to count within the string s.


Return Value

Returns the number of times the character c appears in the string s.

Notes

If s is NULL, the behavior is undefined. The function does not modify the input string.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples