sort.c
changeset 0 7f37716d4f1e
child 4 b2dfe3374454
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sort.c	Sun Aug 05 23:06:42 2007 +0200
@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "dictre.h"
+
+extern struct Word words[];
+extern int nwords;
+
+static int cmp_words(const void *v1, const void *v2)
+{
+    struct Word *w1 = (struct Word *) v1;
+    struct Word *w2 = (struct Word *) v2;
+
+    return strcmp(w1->w, w2->w);
+}
+
+int sort_words()
+{
+    qsort(words, nwords, sizeof(words[0]), cmp_words);
+}