Question: 3) 10 Bonus Question. Write a program that reads a sequence of words from an input file, sorts the words in alphabetical order and then


3) 10 Bonus Question. Write a program that reads a sequence of words from an input file, sorts the words in alphabetical order and then outputs them on the screen. For this exercise a word is a sequence of lower case letters. Note that the alphabetical order is consistent with the increasing order of the integer values of the characters. To read the data from the input file your program invokes the function read wordsO with prototype . char **read_word s (const char *input filename, int *nPtr) Note that input_filename is a string representing the name of the input file. This function has to store the words in an array of strings. The memory for the array of strings and for each string has to be allocated dynamically (ie., using malloc() or call ocO ). Do not allocate more memory then necessary for the array of strings and for the individual words. The input file contains a positive integer representing the number of words, on the first line. Then the words follow one per line. Function read_wordsO has to store the number of words in the variable pointed to by nPtr Additionally, the function returns a pointer to the beginning of the array of strings that was dynamically allocated
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
