From fad28509e7463082a508b761c797773538df7d27 Mon Sep 17 00:00:00 2001 From: Stefan Zabka Date: Thu, 11 Jun 2020 01:00:32 +0200 Subject: First ideas --- 04_exercise/quicksort.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to '04_exercise/quicksort.c') diff --git a/04_exercise/quicksort.c b/04_exercise/quicksort.c index 88a47a2..f912f2b 100644 --- a/04_exercise/quicksort.c +++ b/04_exercise/quicksort.c @@ -3,6 +3,7 @@ #include #include #include +#include static size_t partition(int v[], size_t len); @@ -87,9 +88,9 @@ int main(int argc, const char *argv[]) { /* read the length of the list from the command line */ size_t list_len = 30000000; if (argc >= 2) { - long arg = atol(argv[1]); + long arg = strtol(argv[1], (char **)&argv[strlen(argv[1])], 10); if (arg > 0) - list_len = arg; + list_len = (size_t)arg; } /* generate a list with random integers */ -- cgit v1.2.3-54-g00ecf