diff options
author | Michael Hunteman <michael@huntm.net> | 2024-01-19 10:18:56 -0600 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2024-01-19 10:18:56 -0600 |
commit | 1699bc3c493678a18d1ee50b725a7512e0ff6095 (patch) | |
tree | 9a79ac428ed4fc6b6c126cc502dd3bdd5bb77e34 /one | |
parent | 4bc2b752c41dc9bdcbd037fde9a72a3a1f85792d (diff) |
Fill arrays with zeros
Diffstat (limited to 'one')
-rw-r--r-- | one/count.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/one/count.c b/one/count.c index 0f5bb82..05660f0 100644 --- a/one/count.c +++ b/one/count.c @@ -5,17 +5,10 @@ int main() { int c, i, nwhite, nother; - int ndigit[10]; - int nchar[26]; + int ndigit[10] = {0}; + int nchar[26] = {0}; nwhite = nother = 0; - for (i = 0; i < 26; ++i) { - if (i < 10) { - ndigit[i] = 0; - } - nchar[i] = 0; - } - while ((c = getchar()) != EOF) { if (c >= '0' && c <= '9') { ++ndigit[c - '0']; |