|
C Fundamentals
Algorithms · data structures · cryptography · systems — pure C11, zero deps
|
Sorting CLI — pick an algorithm, sort either argv or stdin. More...
Go to the source code of this file.
Macros | |
| #define | MAX_WORD_LEN 256 |
| #define | MAX_WORDS 1024 |
Typedefs | |
| typedef void(* | string_sort_fn) (char **, size_t) |
Functions | |
| static string_sort_fn | algo_from_name (const char *name) |
| int | main (int argc, char *argv[]) |
| static void | print_array (char **arr, size_t n, const char *label) |
| static void | print_usage (const char *prog) |
Sorting CLI — pick an algorithm, sort either argv or stdin.
Usage: sorting [–algo=NAME] [words ...] echo -e "banana\napple\ncherry" | sorting [–algo=NAME]
NAME ∈ {selection, insertion, bubble, quick, merge}. Default: selection.
Definition in file algorithms/sorting/main.c.
| #define MAX_WORD_LEN 256 |
Definition at line 18 of file algorithms/sorting/main.c.
| #define MAX_WORDS 1024 |
Definition at line 17 of file algorithms/sorting/main.c.
| typedef void(* string_sort_fn) (char **, size_t) |
Definition at line 20 of file algorithms/sorting/main.c.
|
static |
Definition at line 22 of file algorithms/sorting/main.c.
References bubble_sort_strings(), heap_sort_strings(), insertion_sort_strings(), merge_sort_strings(), quicksort_strings(), and selection_sort_strings().
Referenced by main().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 52 of file algorithms/sorting/main.c.
References algo_from_name(), MAX_WORD_LEN, MAX_WORDS, print_array(), print_usage(), and selection_sort_strings().
|
static |
Definition at line 43 of file algorithms/sorting/main.c.
Referenced by main().
|
static |
Definition at line 33 of file algorithms/sorting/main.c.
Referenced by main().