Question
complete the two functions in the provided file proj4.c such that when that module is compiled with the provided code in main.c and proj4.h #include
complete the two functions in the provided file proj4.c such that when that module is compiled with the provided code in main.c and proj4.h
#include "proj4.h"
/*DO NOT MODIFY ANYTHING IN THIS FILE * The global count array stores the count of each letter (a-z), * where count[0] = # of a's, count[1] = # of b's, * count[2] = # of c's, ..., count[25] = # of z's. */ int count[26];
static char * s1[] = {"Stark", "Lannister", "Tully"}; static int n1 = 3;
static char * s2[] = { "Zoey", "Gracie", "Roddie", "Darla", "Peanut", "Roxie", "Joe", "Cassie", "Sadie", "Scooby Doo", "Scrappy Doo", "Astro", "Balto", "Beethoven", "Benji", "Clifford", "Courage the Cowardly Dog", "Droopy", "Fido", "Goofy", "Snoopy", "Brian Griffin", "Pluto", "Underdog", "Odie", "Santa's Little Helper", "Lady", "Marley", "McGruff", "Hachiko", "Porthos", "Rin Tin Tin", "Lassie", "Todo", "Samantha" }; static int n2 = 35;
static char * s3[] = { "R2-D2", "Rosie", "Johnny 5", "Motoko Kusanagi", "Bishop", "HAL 9000", "Bender", "Data", "Megatron", "Optimus Prime", "Wall-E", "BB-8", "KIT", "Terminator", "Ultron" }; static int n3 = 15;
/* * Print the testNum and values in count * to stdout. */ void printCount(int testNum);
//Test the initializeCount and letterCount functions int main(void){
initializeCount(); letterCount(s1, n1); printCount(1);
initializeCount(); letterCount(s2, n2); printCount(2);
initializeCount(); letterCount(s3, n3); printCount(3);
return 0; }
/* * Print the testNum and values in count * to stdout. */ void printCount(int testNum){ int i; char c; printf("===Test %d=== ", testNum); for(i = 0, c = 'a'; i
Introduction For this project, you are going to complete a multi-module C program that uses many programming concepts we covered this semester (functions, loops, strings, pointers, arrays of pointers, global variables, static variables, external variables, etc.). Your assignment is to complete the two functions in the provided file proj4.c such that when that module is compiled with the provided code in main.c and proj4.h using our Makefile, the multi-module program outputs the same letter counts as shown in the Examples section of this document. Before you start this project, read through the provided files (main.c, proj4.h, proj4.c, and Makefile) and the examples at end of the document. Once you get an idea of what the program should do, then implement the functions in proj4.c. After you finish implementing all the functions in proj4.c, your program should compile (without any warnings or errors) using the following command on our Unix machines. make compile make run
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started