summaryrefslogtreecommitdiffstats
path: root/1/20.c
diff options
context:
space:
mode:
authorSadeep Madurange <smadurange@users.noreply.github.com>2021-11-21 13:06:29 +0800
committerSadeep Madurange <smadurange@users.noreply.github.com>2021-11-21 13:06:29 +0800
commitf72ba11006b4b4496709d38fea0ac4854d5ba30f (patch)
tree9f8df7d1374c936bb8e1a5d02f960388b936cd92 /1/20.c
parentea74e68369f44bf5766704db626c23b001f5fdc3 (diff)
downloadk&r-exercises-f72ba11006b4b4496709d38fea0ac4854d5ba30f.tar.gz
1.21
Diffstat (limited to '1/20.c')
-rw-r--r--1/20.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/1/20.c b/1/20.c
index a4f38cb..7ec32ac 100644
--- a/1/20.c
+++ b/1/20.c
@@ -8,14 +8,15 @@ void detab(char to[], char from[], int n);
/* detabs input by replacing tabs with specified number of blanks */
int main(int argc, char *argv[]) {
+ int tabw;
char s[MAXLEN], dtab[MAXLEN];
- int tabw = atoi(argv[1]);
- printf("Enter text to detab and press ctrl+d\n");
+ tabw = atoi(argv[1]);
+ printf("Enter text to detab and press ctrl+d\n");
+
getstr(s);
detab(dtab, s, tabw);
-
printf("\nTab width: %d\n", tabw);
printf("%s\n", dtab);