Homework 9CSC 3320Write a C program, which reads the file “file.txt” and counts the frequency of each digit (0, 1, 2, ..., 9)/letter (A/a, B/b, …, Z/z). Then, use fork() to duplicate a child process to write the most frequent digit/letter at the end of the file “file.txt”. The parent process output the frequency of each digit/letter to the terminal. You need to call the function “mostfrequent” (which is used for calculating the most frequent digit/letter defined below) in your program.int mostfrequent(int * a, int length) /*length is the length of the array. The function returns the index of the largest value of array a.*/{ int index=0; int max=a[0]; int i; for(i=1;i<length;i++) if (a[i]>max) { max = a[i]; index = i; } return index;}Here is the running
View Full Document