changeset 0 | 7f37716d4f1e |
child 4 | b2dfe3374454 |
-1:000000000000 | 0:7f37716d4f1e |
---|---|
1 #include <stdio.h> |
|
2 #include <stdlib.h> |
|
3 #include "dictre.h" |
|
4 |
|
5 extern struct Word words[]; |
|
6 extern int nwords; |
|
7 |
|
8 static int cmp_words(const void *v1, const void *v2) |
|
9 { |
|
10 struct Word *w1 = (struct Word *) v1; |
|
11 struct Word *w2 = (struct Word *) v2; |
|
12 |
|
13 return strcmp(w1->w, w2->w); |
|
14 } |
|
15 |
|
16 int sort_words() |
|
17 { |
|
18 qsort(words, nwords, sizeof(words[0]), cmp_words); |
|
19 } |