hello people....i just started to learn C so im very new with it....
im trying to calculate to the number of letters that i have in a string
for example :
string = GoforEEeexpeRT
the result should be
the letter is E , 5 times.
so far i tried to this but im getting error when im trying to run it .
can someone help me with it, thanks in advance.
Code:
#include <stdio.h>
#define ABC 100
int main()
{
char st[ABC];
int a[ABC], i,j;
printf("\nPlease enter the string\n");
for (i=0; i<ABC; i++) /* initialization */
a[i]=0;
j=0;
while (st[j]!='\0')
{
if (st[j]>='A'&& st[j]<='Z')
st[j]=st[j]+32 ;
j++;
}
i=0;
for(i=0;i<ABC;i++)
for(k=i;k<ABC;k++)
{
if (st[k]==st[i])
a[i]++;
}
while(
i++;
ch[i] = s[i];
printf("the letter is %s\n", s);
}
}