diff options
| author | Zhineng Li <[email protected]> | 2026-01-10 18:13:21 +0800 |
|---|---|---|
| committer | Zhineng Li <[email protected]> | 2026-01-10 18:13:21 +0800 |
| commit | 3277de12c2a3682368ecf351877ae54923704be6 (patch) | |
| tree | 39fdcfb63725e9b4070a326b005de26c65fc632a /ch01 | |
| parent | 86624a9e6d2baaedd5a1b8dd4e5412216cfc635a (diff) | |
| download | c-knr-exercises-3277de12c2a3682368ecf351877ae54923704be6.tar.gz c-knr-exercises-3277de12c2a3682368ecf351877ae54923704be6.zip | |
ex01-13: rename variable `nlen`
Diffstat (limited to 'ch01')
| -rw-r--r-- | ch01/ex13-histogram.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ch01/ex13-histogram.c b/ch01/ex13-histogram.c index 14002a5..fbccb2a 100644 --- a/ch01/ex13-histogram.c +++ b/ch01/ex13-histogram.c @@ -7,10 +7,10 @@ int main() { int c, i, j, nc, state; - int ndigit[10]; + int nlen[10]; for (i = 0; i < 10; ++i) - ndigit[i] = 0; + nlen[i] = 0; nc = 0; state = OUT; @@ -20,7 +20,7 @@ int main() i = nc - 1; if (i > 9) i = 9; - ++ndigit[i]; + ++nlen[i]; nc = 0; } state = OUT; @@ -36,7 +36,7 @@ int main() i = nc - 1; if (i > 9) i = 9; - ++ndigit[i]; + ++nlen[i]; nc = 0; } @@ -45,7 +45,7 @@ int main() printf(" >9: "); else printf(" %2d: ", i + 1); - for (j = 0; j < ndigit[i]; ++j) + for (j = 0; j < nlen[i]; ++j) putchar('#'); putchar('\n'); } |
