Question: Write a program in C to sort an array of words. The program reads some words from a file and put them in an array

Write a program in C to sort an array of words. The program reads some words from a file and put them in an array of string (i.e., you need to have an array with two dimensions). Then it sorts the words and prints it. The input text file is formatted in the following way: the first line of the file specifies the size of the array. each line after the first contains a word. MAX_STR_LEN = 30

Your program should have the following function: void selection_sort(int num_of_words, char words[][MAX_STR_LEN]) This method implements the selection sort algorithm.

Example: $ ./sort_words words.txt

The sorted words are: apple banana orange strawberry

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!