2 5dc21454 2023-07-14 jrmu * 1-20. Write a program detab that replaces tabs in the input with the proper number of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every n columns. Should n be a variable or a symbolic parameter?
5 5dc21454 2023-07-14 jrmu #include <stdio.h>
6 5dc21454 2023-07-14 jrmu #define TABSTOP 8
11 5dc21454 2023-07-14 jrmu int col = 1, i;
12 5dc21454 2023-07-14 jrmu while ((c = getchar())!=EOF) {
13 5dc21454 2023-07-14 jrmu if (c == '\t') {
14 5dc21454 2023-07-14 jrmu for (i = 0; i == 0 || (i+col-1)%TABSTOP != 0; ++i) {
15 5dc21454 2023-07-14 jrmu printf(" ");
19 5dc21454 2023-07-14 jrmu printf("%c", c);
21 5dc21454 2023-07-14 jrmu if (c == '\n')