Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please someone could help me with this project. Write a procedure named Get_freq

ID: 3548610 • Letter: P

Question

Please someone could help me with this project.

Write a procedure named Get_frequencies that constructs a character frequency table.
Input to the procedure should be a pointer to a string, and a pointer to an
array of 256 doublewords. Each array position is indexed by its corresponding
ASCII code. When the procedure returns, each entry in the array contains a
count of how many times that character occurred in the string. Include the
source code only.


Ps: Also test and showing the output and the screenshot will be very helpfull!

Thank you!

Explanation / Answer

#include "stdio.h"
#include "conio.h"
#include "string.h"
void Get_frequencies(char *,double *);
void main(){
char *c;
double freq_table[256];
int i;
clrscr();
for(i=0;i<256;i++)
freq_table=0;
printf(" Enter a string : ");
gets(c);
Get_frequencies(c,freq_table);
printf(" The Frequency Table ");
for(i=0;i<256;i++){
printf(" %c %d",(char)i,(int)freq_table);
if(i%10==0)//this is used only for the display purpose.
getch();
}
}
void Get_frequencies(char *s,double *count){
int i,j;
for(i=0;i<strlen(s);i++){
for(j=0;j<256;j++){
if(s==(char)j)
count[j]+=1;
}
}
}