Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
bool rt = false;
for (int i = 0; i < length-1; i++) {
if (criteria(array[i], array[i+1])) {
- swap_int_ptr(&array[i], &array[i+1]);
+ swap_int(&array[i], &array[i+1]);
if (!rt) { rt = true; };
}
}
#include "utils.h"
-void swap_int_ptr(int* v1, int* v2) {
+void swap_int(int* v1, int* v2) {
int tmp = *v1;
*v1 = *v2;
*v2 = tmp;
#ifndef UTILS_H
#define UTILS_H
-void swap_int_ptr(int* v1, int* v2);
+#include "macros.h"
+
+void swap_int(int* v1, int* v2);
void swap_ptr(void* v1, void* v2);
#endif /* UTILS_H */
#include <stdio.h>
-#include "macros.h"
-
int main() {
printf("Hello world\n");