sort.c
changeset 74 829976007e62
parent 73 d0578510aea1
child 77 49e0babccb23
--- a/sort.c
+++ b/sort.c
@@ -27,7 +27,12 @@
 
 void swap (int *v, int i, int j)
 {
-    int old = v[i];
+    int old;
+
+    if (i == j)
+        return;
+
+    old = v[i];
 
     v[i] = v[j];
     v[j] = old;