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 34
|
static void affiche(char const **a, size_t n)
{
size_t i;
i = 0;
while (i < n)
{
printf ("%s\n", a[i]);
i++;
}
printf ("\n");
}
static int comp(void const *az,void const *b)
{
char const *const *pa = az;
char const *const *pb = b;
return strcmp (*pa, *pb);
}
int main (void)
{
char const *tabz[] = {"1 3 437 t negcy", "1 248 260 568 g","1 199 424 393 919 et lfsii cvttu mjgh","1 117 491 wi extu afj"};
affiche(tabz,(sizeof tabz / sizeof *tabz));
qsort(tabz, (sizeof tabz / sizeof *tabz), sizeof *tabz, comp);
affiche(tabz, (sizeof tabz / sizeof *tabz));
return 0;
} |