exercism

Exercism solutions.
Log | Files | Refs

commit 759b3580354c7f7140afd432a5ae67e66a2efac1
parent 85199771575e2937bbcae73db7529afba864e0d7
Author: dwrz <dwrz@dwrz.net>
Date:   Sun, 24 Feb 2019 15:56:34 +0000

Reformat for c/isogram for conciseness

Diffstat:
Mc/isogram/src/isogram.c | 14++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/c/isogram/src/isogram.c b/c/isogram/src/isogram.c @@ -9,21 +9,15 @@ int length(const char string[]) { char lowercase(char c) { // Lowercase only ASCII uppercase chars. - if (c >= 65 && c <= 90) { - return c + 32; - } + if (c >= 65 && c <= 90) { return c + 32; } return c; } bool is_symbol_char(char c) { // Catch chars that precede or follow alpha chars. - if (c < 65 || c > 122) { - return true; - } + if (c < 65 || c > 122) { return true; } // Catch chars intervening the upper and lowercase alpha chars. - if (c > 90 && c < 97) { - return true; - } + if (c > 90 && c < 97) { return true; } return false; } @@ -36,7 +30,7 @@ bool is_isogram(const char phrase[]) { for (int i = 0; i < length(phrase); i++) { if (is_symbol_char(phrase[i])) { continue; } // Ignore non-alpha chars. if (char_map[lowercase(phrase[i]) - 97] != 0) { return false; } - // Keep track of chars by incrementing the index value. + // Increment the count for this char. char_map[lowercase(phrase[i]) - 97]++; } return true;