Question: I need help with this code, it requires a makefile also but i can make that #include #include #include sorting functions.h #define ARRAYSIZE 10 int

I need help with this code, it requires a makefile also buti can make that #include #include #include "sorting functions.h" #define ARRAYSIZE 10int main (void) { // dynamically allocate memory space for an arrayI need help with this code, it requires a makefile also but i can make that

#include #include #include "sorting functions.h" #define ARRAYSIZE 10 int main (void) { // dynamically allocate memory space for an array int * array?tr = (int *) malloc (ARRAYSIZE * sizeof(int)); // fill the array with random integers // print the array, 10 elements per line // sort the array using selection sort and print the return value // print the array, 10 elements per line // fill the array again with random integers // print the array // sort with insertion sort and print the return value // print the array } 2. Create a file called sortingfunctions.h Write a preprocessor wrapper (following convention for constant name) and then insert the following prototypes. int selectionsort (int * const array, int size); int insertionsort (int * const array, int size ); void swap (int * numl, int * num2); void fillArray ( int * const data, int size, int min, int max ); void neat Print ( int * const data, int size, int numberline, int fieldsize ); 3. Create a file called sortingfunctions.c Write the implementation of the five functions. int selectionsort ( int * const data, int size ); sorts the array using the selection ort algorithm Caution: there are a lot of programs out there on the web that claim to be selection sort written in c. The class syllabus prohibits copying code from web sites. A grade of zero will be assigned for this assignment if the TA or instructor sees evidence that you have copied code. You You cannot use the bracket [ ] notation to access array elements. have to use pointer/offset notation. The return value is a count of the number of comparisons that are made. Specifically, you should count the number of times that the program executes an if statement that compares the values of two array elements. int insertionsort (int * const data, int size ); sorts the array using the insertion sort algorithm Caution: there are a lot of programs out there on the web that claim to be insertion sort written in c. The class syllabus prohibits copying code from web sites. A grade of zero will be assigned for this assignment if the TA or instructor sees evidence that you have copied code. You cannot use the bracket [ ] notation to access array elements. You have to use pointer/offset notation. The return value is a count of the number of comparisons that are made. Specifically, you should count the number of times that the program executes an if statement that compares the values of two array elements. void swap( int * numi, int * num2); Exchanges the contents of the two memory locations. void fillArray ( int * const data, int size, int min, int max ); Fills the array elements with integers from min to max (inclusive). You cannot use the bracket [ ] notation to access array elements. You have to use pointer/offset notation. void neat Print ( int * const data, int size, int numberline, int fieldsize ); Prints the array elements in nice, neat columns using the parameters numberline and fieldsize to control the layout. You cannot use the bracket [ ] notation to access array elements. You have to use pointer/offset notation

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!