![Computers and Technology](/tpl/images/cats/informatica.png)
Computers and Technology, 12.01.2021 18:00, cassiuspricerules
Write a function SwapArrayEnds() that swaps the first and last elements of the function's array parameter. Ex: sortArray = {10, 20, 30, 40} becomes {40, 20, 30, 10}. The array's size may differ from 4.
#include
using namespace std;
/* Your solution goes here */
int main() {
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) {
cout << sortArray[i] << " ";
}
cout << endl;
return 0;
}.
![answer](/tpl/images/cats/otvet.png)
Answers: 2
Other questions on the subject: Computers and Technology
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
Do you know the correct answer?
Write a function SwapArrayEnds() that swaps the first and last elements of the function's array para...
Questions in other subjects:
![Konu](/tpl/images/cats/informatica.png)
Computers and Technology, 18.10.2020 07:01
![Konu](/tpl/images/cats/istoriya.png)
![Konu](/tpl/images/cats/es.png)
Spanish, 18.10.2020 07:01
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/biologiya.png)
![Konu](/tpl/images/cats/en.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 18.10.2020 07:01
![Konu](/tpl/images/cats/mat.png)
Mathematics, 18.10.2020 07:01
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/himiya.png)
Chemistry, 18.10.2020 07:01