C language Count the number of characters in the string

http‮w//:s‬ww.lautturi.com
C language Count the number of characters in the string

How to find the frequency of characters in a string - C language

#include <stdio.h>
int main() {
    char str[] = "Hello lautturi world";
	char ch = 'i';
    int count = 0;

    for (int i = 0; str[i] != '\0'; ++i) {
        if (ch == str[i])
            ++count;
    }

    printf("Frequency of %c = %d", ch, count); // 3
    return 0;
}
Created Time:2017-08-28 18:44:49  Author:lautturi