Given an array arr of type int, along with two int variables i and j, write some code that swaps the values of arr[i] and arr[j]. Declare any additional variables as necessary.
.
.
Click on the title for the solution
.
.
.
Click on the title for the solution
.
.
This is the answer:
:
int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp;
Comments
Post a Comment