Actually recently i found a problem where i need to count occurrence a given(by oj) char in a given string(with test case).So i write this code but output is not as i desired.I'm a beginner so i'll be greatly thankful for any kind of instructive advice or help.THANK YOU.
#include<stdio.h>
#include<string.h>
int main ()
{
    int ara [123];
    char s[1000];
    int l, j, i, len;
    char c;
    scanf ("%d\n", &l);
    while (l >= 0){
        for (i = 65; i <= 122; i++)
        {
            ara[i] = 0;
        }
        fgets(s, 1000, stdin);
        len = strlen(s);
        for (i = 0;i <= len; i++)
        {
            ara[s[i]]++;
        }
        scanf(" %c\n", &c);
        j = c;
        printf("count : %d\n", ara[j]);
        l--;
    }
    return 0;
}
 
     
    