summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhineng Li <[email protected]>2026-01-10 18:15:14 +0800
committerZhineng Li <[email protected]>2026-01-10 18:15:14 +0800
commit20d3661062b7b42fcfa91cc9b43f2a6752804e62 (patch)
treecba09a17cb8db46666405a322b161a491137feed
parent3277de12c2a3682368ecf351877ae54923704be6 (diff)
downloadc-knr-exercises-20d3661062b7b42fcfa91cc9b43f2a6752804e62.tar.gz
c-knr-exercises-20d3661062b7b42fcfa91cc9b43f2a6752804e62.zip
ex01-13: extract bar character
-rw-r--r--ch01/ex13-histogram.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ch01/ex13-histogram.c b/ch01/ex13-histogram.c
index fbccb2a..47ed574 100644
--- a/ch01/ex13-histogram.c
+++ b/ch01/ex13-histogram.c
@@ -3,6 +3,8 @@
#define IN 1 /* inside a word */
#define OUT 0 /* outside a word */
+#define INDICATOR_BAR '#'
+
/* print a histogram of word lengths */
int main()
{
@@ -46,7 +48,7 @@ int main()
else
printf(" %2d: ", i + 1);
for (j = 0; j < nlen[i]; ++j)
- putchar('#');
+ putchar(INDICATOR_BAR);
putchar('\n');
}
}