diff options
author | Stefan Zabka <zabkaste@hu-berlin.de> | 2020-06-11 01:00:32 +0200 |
---|---|---|
committer | Stefan Zabka <zabkaste@hu-berlin.de> | 2020-06-11 01:00:32 +0200 |
commit | fad28509e7463082a508b761c797773538df7d27 (patch) | |
tree | c393af67d54e12f43c182fe776ca20f6a0333d78 /04_exercise/quicksort.c | |
parent | 1bec4c4e1e16aa12965d124f83590ba007b88719 (diff) | |
download | betriebssysteme-fad28509e7463082a508b761c797773538df7d27.tar.gz betriebssysteme-fad28509e7463082a508b761c797773538df7d27.zip |
First ideas
Diffstat (limited to '04_exercise/quicksort.c')
-rw-r--r-- | 04_exercise/quicksort.c | 5 |
1 files changed, 3 insertions, 2 deletions
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 <stdio.h> #include <stdlib.h> #include <time.h> +#include <string.h> 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 */ |