sort.c
author viric@mandarina
Sat, 08 Sep 2007 09:13:15 +0200
changeset 29 84abeba4ef3b
parent 4 b2dfe3374454
permissions -rw-r--r--
Removing binary.
viric@0
     1
#include <stdio.h>
viric@0
     2
#include <stdlib.h>
viric@0
     3
#include "dictre.h"
viric@0
     4
viric@0
     5
extern struct Word words[];
viric@0
     6
extern int nwords;
viric@0
     7
viric@0
     8
static int cmp_words(const void *v1, const void *v2)
viric@0
     9
{
viric@0
    10
    struct Word *w1 = (struct Word *) v1;
viric@0
    11
    struct Word *w2 = (struct Word *) v2;
viric@0
    12
viric@0
    13
    return strcmp(w1->w, w2->w);
viric@0
    14
}
viric@0
    15
viric@0
    16
int sort_words()
viric@0
    17
{
viric@4
    18
    printf("Sorting...\n");
viric@0
    19
    qsort(words, nwords, sizeof(words[0]), cmp_words);
viric@0
    20
}