/************************************************** * Section : 15 * Machine No. : N * Roll No. : 19CS100XY * Name : Aritra Hazra * Assignment No : 8 * Description : Determines Statistics of Word Array ***************************************************/ #include #include #include #include void initializeWordsArray(char ***pwords, int wc, int wl) { int i; (*pwords) = (char **)malloc(wc * sizeof(char *)); for(i=0; i 10) wordLen_10_more++; /* word having length more than 10 characters */ else if(strlen(words[i]) > 5) wordLen_6_10++; /* word having length between 6-10 characters */ else if(strlen(words[i]) > 2) wordLen_3_5++; /* word having length between 3-5 characters */ else wordLen_1_2++; /* word having length between 1-2 character(s) */ } printf("\n-- The Word Length Statistics --\n"); printf("Number of Words with Length 1-2: %d\n", wordLen_1_2); printf("Number of Words with Length 3-5: %d\n", wordLen_3_5); printf("Number of Words with Length 6-10: %d\n", wordLen_6_10); printf("Number of Words with Length larger than 10: %d\n", wordLen_10_more); } void printAlphabetDistribution(char **words, int wc) { int i, j, totalCharCount=0, totalVowelCount = 0, totalCapsCount = 0, charCount, charPercent; char ch; printf("\n-- The Alphabet Distribution --\n"); /* finding total number of characters */ for(i=0; i i+1){ printf(" %s", words[i]); for(k=0; k