4 bool ascending(int a
, int b
) {
8 bool descending(int a
, int b
) {
12 bool ascending_and_even(int a
, int b
) {
13 return (((a
% 2 != 0) && (b
% 2 == 0)) || ((a
% 2 == 0) && (b
% 2 == 0) && ascending(a
, b
)) \
14 || ((a
% 2 != 0) && (b
% 2 != 0) && ascending(a
, b
)));
17 bool ascending_and_odd(int a
, int b
) {
18 return (((a
% 2 == 0) && (b
% 2 != 0)) || ((a
% 2 == 0) && (b
% 2 == 0) && ascending(a
, b
)) \
19 || ((a
% 2 != 0) && (b
% 2 != 0) && ascending(a
, b
)));
22 static bool sort_first(int* array
, unsigned length
, s_criteria_cb sort_criteria
) {
24 for (unsigned i
= 0; i
< length
-1; i
++) {
25 if (sort_criteria(array
[i
], array
[i
+1])) {
26 swap_int(&array
[i
], &array
[i
+1]);
33 /* the feature of this function is awaited in the array.c file */
34 void sort_bubble_array(int* array
, unsigned length
, s_criteria_cb sort_criteria
) {
37 rt
= sort_first(array
, length
, sort_criteria
);