Count a character · Contar um caractere
Count a character
Return how many times a given character appears in a C-string. Loop over the characters until the null terminator, adding 1 each time the current character matches target.
Conte um caractere
Retorne quantas vezes um caractere específico aparece em uma string C. Faça um loop sobre os caracteres até o nulo, somando 1 sempre que o caractere atual corresponder a target.
Complete int count_char(const char *s, char target) to return how many times target appears in the C-string s. · Complete int count_char(const char *s, char target) para retornar quantas vezes target aparece na string C s.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.