</>EmbeddedInterview

Count occurrences of a character in a string.

Easy"Coding: Memory & String Functions"
#include <stddef.h>

size_t count_char(const char *s, char c)
{
    size_t n = 0;
    for (; *s; s++) n += (*s == c);
    return n;
}

Points: O(n); to count all characters at once use a 256-entry table; strchr in a loop is an alternative.