#include <stdio.h>
#include <string.h>
int main()
{
char string[100];
int c = 0, count[26] = {0};
printf("Enter a string\n");
gets(string);
while (string[c] != '\0')
{
if (string[c] >= 'a' && string[c] <= 'z')
count[string[c]-'a']++; /*I do not understand this line/*
c++;
}
for (c = 0; c < 26; c++)
{
if (count[c] != 0)
printf("%c %d \n",c+'a',count[c]);
}
return 0;
}
Mir Mahfuz 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.