summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--one/count.c11
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'];