Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

C program to find frequency of each character in a text
file?

Answer Posted / vadivel

#include <stdio.h>
int count[26];
int main()
{
FILE *f;
int i;
char ch;
f = fopen("capti.c","r");
while(!feof(f))
{
ch = fgetc(f);
count[ch - 'a']++;
}
for(i = 0;i < 26;i++)
printf("count[%c] = %d\n",65+i,count[i]);
fclose(f);
return 0;
}
//asuming only lower characters are required

Is This Answer Correct ?    38 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why doesnt long int work?

977


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1324


What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?

1019


what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?

1799


Do you know what are the properties of union in c?

997


What are the differences between Structures and Arrays?

1129


Is python a c language?

946


What is c variable?

996


When should the volatile modifier be used?

1106


Can a function argument have default value?

1091


Write a program to reverse a linked list in c.

1065


What is the difference between typedef struct and struct?

1064


When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

1208


What is #define in c?

990


What is double pointer?

949