Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 490 Bytes

README.md

File metadata and controls

9 lines (5 loc) · 490 Bytes

Exercise 5-13

Write the program tail, which prints the last n lines of its input.

By default, n is 10, let us say, but it can be changed by an optional argument, so that tail -n prints the last n lines.

The program should behave rationally no matter how unreasonable the input or the value of n.

Write the program so it makes the best use of available storage; lines should be stored as in the sorting program of Section 5.6, not in a two-dimensional array of fixed size.