K&R Exercises

Exercise 1-20: Detab

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?

Put a tab stop every 8 columns: a tab moves to the next multiple of 8, counting from column 0 at the start of each line. Every other character takes one column.

Test Cases

· space→ tab↵ newline

Submissions

No submissions yet