previous
|
index
|
next
Swapping Array Elements
Q
: How to swap two elements
a[i]
and
a[j]
of an integer array?
int temp = a[i]; // 1 a[i] = a[j]; // 2 a[j] = temp; // 3
previous
|
index
|
next