Bonjour, oups tromper de forum



Je ne comprends pas les instructions de la fonction ordonnerTableau


Pouvez vous me commenter en détail si possible cette fonction ordonnerTableau?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
int main(int argc, char *argv[])
{
    long tableau[10] = {2, 4, 3, 1, 15, 6, 9, 16, 19, 12};
    long i = 0;
 
    ordonnerTableau(tableau, 10);
 
    for(i = 0; i < 10; i++)
    {
        printf("%ld\n", tableau[i]);
    }
 
    return 0;
}
 
 
void ordonnerTableau(long tableau[], long tailleTableau)
{
    long i = 0, j = 0, a = 0;
 
    for(j = 0; j < tailleTableau-1; j++)
    {
        for(i = 0; i < tailleTableau-1; i++)
        {
            if(tableau[i] > tableau[i+1])
            {
                a = tableau[i+1];
                tableau[i+1] = tableau[i];
                tableau[i] = a;
            }
        }
    }
}