Question: MUST BE IN C PROGRAMMING! Q2.1) The following code should implement a sort algorithm to sort an array of integer numbers of size n in

MUST BE IN C PROGRAMMING!

Q2.1) The following code should implement a sort algorithm to sort an array of integer numbers of size n in ascending order. Complete the implementation of the Sort and Swap functions

void PrintArray(int size, int array []){

for(int i=0; i

printf("array[%d] = %d ", i , array[i]);

}

}

Void swap(int * var1, int * var2){

//provide implementation

}

void sort(int size, int array[]){

//provide implementation

}

int main(){

int data [] = {2, 7, 8, -8, 1, 9, 3, 5};

SelectrionSort(sizeof(data)/sizeof(int), data);

PrintArray(sizeof(data)/sizeof(int), data);

return 0;

}

Q2.2) Change the PrintArray Function to print the memory address of each element in the array in addition to the element index within the array and the element value. What do you notice about the memory addresses of the array elements?

Q2.3) Write a C function named ArrayInfo( ) of type void that takes an array of n integers and calculate the sum of the elements in the array, the average, find the minimum value, the maximum value and made this information available to the main function. Hint use pointers and call by references

Q2.4) Implement a function ReverseArray to reverse the elements of the array to sort it in descending order. The function ReverseArray has the following prototype:

void ReverseArray(int size, int *ptr2Array):

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!