K&R Exercises

Exercise 5-11: detab with a list of tab stops

Modify the program entab and detab (written as exercises in Chapter 1) to accept a list of tab stops as arguments. Use the default tab settings if there are no arguments.

Write detab this way (Exercise 5-12 does entab). Each argument is the column of a tab stop, in increasing order, counting from column 0 at the start of each line; there are at most 100. A tab moves to the next tab stop, and past the last one becomes a single blank. With no arguments, put a tab stop every 8 columns, as in Exercise 1-20.

Test Cases

· space→ tab↵ newline

Submissions

No submissions yet