Answer:
see explaination
Explanation:
#include<stdio.h>
/* Your solution goes here */
//Impllementation of SwapArrayEnds method
void SwapArrayEnds(int sortArray[],int SORT_ARR_SIZE){
//Declare tempVariable as integer type
int tempVariable;
if(SORT_ARR_SIZE > 1){
tempVariable = sortArray[0];
sortArray[0] = sortArray[SORT_ARR_SIZE-1];
sortArray[SORT_ARR_SIZE-1] = tempVariable;
}
}
int main(void) {
const int SORT_ARR_SIZE = 4;
int sortArray[SORT_ARR_SIZE];
int i = 0;
sortArray[0] = 10;
sortArray[1] = 20;
sortArray[2] = 30;
sortArray[3] = 40;
SwapArrayEnds(sortArray, SORT_ARR_SIZE);
for (i = 0; i < SORT_ARR_SIZE; ++i) {
printf("%d ", sortArray[i]);
}
printf("\n");
return 0;
}
Please go to attachment for the program screenshot and output