From d0d76324cc17be550ce6c603dd7efb60e97920be Mon Sep 17 00:00:00 2001 From: David Phillips Date: Thu, 14 Sep 2017 21:19:00 +1200 Subject: Style adjustment --- words-misc/permutations.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'words-misc/permutations.c') diff --git a/words-misc/permutations.c b/words-misc/permutations.c index 7f6b0ef..13374db 100644 --- a/words-misc/permutations.c +++ b/words-misc/permutations.c @@ -2,32 +2,21 @@ #include #include -void swap_chr(char*, char*); -void p(char *, size_t, size_t); -void die_help(const char*); - -int main(int argc, char **argv) -{ - if (argc != 2) - die_help(argv[0]); - - p(argv[1], strlen(argv[1]), 0); - - return 0; -} - -void die_help(const char* argv0) { +void +die_help(const char* argv0) { fprintf(stderr, "Usage: %s \n", argv0); exit(1); } -void swap_chr(char *a, char *b) { +void +swap_chr(char *a, char *b) { char t = *a; *a = *b; *b = t; } -void p(char *string, size_t x, size_t i) { +void +p(char *string, size_t x, size_t i) { size_t j = 0; if (i == x) { @@ -41,3 +30,14 @@ void p(char *string, size_t x, size_t i) { swap_chr(&string[i], &string[j]); } } + +int +main(int argc, char **argv) +{ + if (argc != 2) + die_help(argv[0]); + + p(argv[1], strlen(argv[1]), 0); + + return 0; +} -- cgit v1.1