You'll need a helper variable for this, so depending on your programming language, the solution becomes:
int helper;
helper = arr[i];
arr[i] = arr[j];
arr[j] = helper;
9.5m questions
12.2m answers