Better memory management of arrays and test sample generation
This commit is contained in:
4
lsort.c
4
lsort.c
@@ -1,9 +1,9 @@
|
||||
#include "./include/lsort.h"
|
||||
|
||||
int check_sorted(lsort_array_i* array) {
|
||||
int check_sorted(lsort_array* array) {
|
||||
if (array->count <= 0) return 2;
|
||||
for (int i = 0; i < array->count - 1; i++) {
|
||||
if (array->items[i] > array->items[i + 1]) {
|
||||
if (array->items[i]->key > array->items[i + 1]->key) {
|
||||
return 1;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user