Remove an unused function parameter.
[Algorithmic_C.git] / TP2 / exo1 / exo1.c
CommitLineData
98c13508
JB
1#include <stdio.h>
2
6eb44436 3void permuter (int T[], int i1, int i2) {
98c13508
JB
4 int tmp = T[i1];
5 T[i1] = T[i2];
6 T[i2] = tmp;
7}
8
9int i_min(int T[], int n, int d) {
10 int min = d;
11 for (int i = d+1; i < n; i++) {
12 if (T[i] < T[min]) {
13 min = i;
14 }
15 }
16 return min;
17}
18
19void SelecEch(int T[], int n) {
20 int imin, d = 0;
21 while (d < n-1) {
22 imin = i_min(T, n, d);
6eb44436 23 permuter(T, d, imin);
98c13508
JB
24 d++;
25 }
26}
27
28void AfficheTab(int T[], int n) {
29 for (int i = 0; i < n; i++) {
30 printf("valeur a index=%d=%d\n", i, T[i]);
31 }
32}
33
34int main() {
35 int T[6] = {2, 5, 3, 1, 4, 6};
36
37 AfficheTab(T, 6);
38
39 SelecEch(T, 6);
40
41 AfficheTab(T, 6);
42
43 return 0;
44}