#include "header.h" int main(void) { char ch; long int count[256]; int n, i; time_t t1,t0; char fname[50]; for (i=0; i<256; i++) { count[i]=0; } printf ("Enter a file with .txt you want to count:\t"); scanf ("%s", &fname); FILE *fp; fp=fopen(fname,"r"); time(&t0); while ( (ch=fgetc(fp))!=EOF ) { n=(int) ch; count[n]++; } time(&t1); for (i=0; i<256; i++) { if ( count[i]!=0 ) printf ("%d %c %d\n", i, (char) i, count[i]); } printf ("The running time is %.3lf seconds.\n", (float) t1-t0); fclose(fp); return 0; }