From a713622831076fb237c0adb3940b9bab1b75ed58 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 17 Jun 2023 15:18:10 +0200 Subject: Added c benchmark --- benchmark/sort.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 benchmark/sort.c (limited to 'benchmark') diff --git a/benchmark/sort.c b/benchmark/sort.c new file mode 100644 index 0000000..657d2be --- /dev/null +++ b/benchmark/sort.c @@ -0,0 +1,20 @@ +#include +#include +#include + +extern int array[]; +extern int size; + +int compare(const void *a, const void *b) +{ + return *(int *)a - *(int *)b; +} + +int main(int argc, char *argv[]) +{ + int len = (int)&size; // ?? + qsort(array, len, sizeof(int), compare); + for (int i = 0; i < len; i++) + printf("%d\n", array[i]); + return 0; +} -- cgit v1.2.3