Browse code

Change the way we include common.c.

Xavier G authored on 25/08/2016 01:37:59
Showing 3 changed files
... ...
@@ -7,6 +7,10 @@
7 7
 
8 8
 #include <stdio.h>
9 9
 
10
+void array_sort(unsigned int **array, unsigned int count);
11
+#define ARRAY_SORT 1
12
+#include "common.c"
13
+
10 14
 /*
11 15
  * Implementation of bubble sort:
12 16
  */
... ...
@@ -46,6 +50,3 @@ void array_sort(unsigned int **array, unsigned int count) {
46 50
 	} while (latest_swap);
47 51
 	printf("  Bubble-sort: made %u swaps to sort %u items.\n", swap_count, count);
48 52
 }
49
-
50
-#define ARRAY_SORT 1
51
-#include "common.c"
... ...
@@ -7,6 +7,10 @@
7 7
 
8 8
 #include <stdio.h>
9 9
 
10
+void array_sort(unsigned int **array, unsigned int count);
11
+#define ARRAY_SORT 1
12
+#include "common.c"
13
+
10 14
 /*
11 15
  * Implementation of insertion sort:
12 16
  */
... ...
@@ -43,6 +47,3 @@ void array_sort(unsigned int **array, unsigned int count) {
43 47
 	}
44 48
 	printf("Insertion sort: made %u insertions, moved %u items.\n", insertions, moved_items);
45 49
 }
46
-
47
-#define ARRAY_SORT 1
48
-#include "common.c"
... ...
@@ -7,6 +7,10 @@
7 7
 
8 8
 #include <stdio.h>
9 9
 
10
+void array_sort(unsigned int **array, unsigned int count);
11
+#define ARRAY_SORT 1
12
+#include "common.c"
13
+
10 14
 /*
11 15
  * Implementation of selection sort:
12 16
  */
... ...
@@ -44,6 +48,3 @@ void array_sort(unsigned int **array, unsigned int count) {
44 48
 		/* (this is done by "++ i" in the for loop) */
45 49
 	}
46 50
 }
47
-
48
-#define ARRAY_SORT 1
49
-#include "common.c"