void selection_sort (int *a, int n) {
int i, j, m, t;
for (i = 0; i < n; i++) {
for (j = i, m = i; j < n; j++) {
if (a[j] < a[m])
m = j;
}
t = a[i];
a[i] = a[m];
a[m] = t;
}
}
int main () {
int a[] = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1};
int n = sizeof a / sizeof a[0];
selection_sort(a, n);
return 0;
}
hi, can u pls help me understand this code line by line..
i understand how selection sort works.
but not able to get this code properly.
just anyone pls explain me the wrking of this code( selection sort function)