Question: Function in c 9. Write a function that reads an input file and creates a sorted output file. The function prototype is void file sort

Function in c
 Function in c 9. Write a function that reads an input

9. Write a function that reads an input file and creates a sorted output file. The function prototype is void file sort (char infile, char outfile). The function takes the file names as parameters. The input file contains student information and has the following format. The first line contains the number of students in the file. Each subsequent line contains information about one student. Each line contains three fields namely student id, grade, and gpa in that order separated by blanks. The student id is a positive integer. The grade is a character. The gpa is a double type value. The function sorts the student information in the ascending order of student id. The ordered student information is written to the output file. The output file has the same format as the input file. The function dynamically allocates three arrays and stores the student information into the arrays. The three arrays are simultaneously sorted. The sorted array information is written to the output file. The dynamic arrays are freed when the function completes its work. Structures should not be used

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!