count_char()

count_char()#

Count the occurrences of a specific character in a string.

Prototype

PUBLIC int count_char(
    const char  *string,
    char         c
);
        

Parameters

Key

Type

Description

string

const char *

The string to search.

c

char

The character to count.


Return Value

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

Prototype

// Not applicable in JS

Prototype

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