Re: I don't quite understand this exercise...
- From: Thad Smith <ThadSmith@xxxxxxx>
- Date: Sun, 25 Sep 2005 22:25:34 -0600
Patrick M. wrote:
I don't quite understand what K&R want me to do in Exercise 1-20 in "The C Programming Language, 2nd Edition". Here's the description:
"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?"
What does this mean? Do they want me to figure out the amount of spaces a tab takes up on my system, and add them? I'm sort of confused about this question.
They mean: write a program to read a text file (or stdin) with tabs and replace all the tabs with equivalent space characters. The result should be an output file (or stdout). This is a general type of program known as a filter, which takes one input file and produces an associated output file with some defined modification.
They are suggesting that you might want to allow some way to specify the tab spacing or tab columns that your input file assumes. That can be done with a command line parameter.
Thad
.
- Follow-Ups:
- Re: I don't quite understand this exercise...
- From: Patrick M.
- Re: I don't quite understand this exercise...
- References:
- I don't quite understand this exercise...
- From: Patrick M.
- I don't quite understand this exercise...
- Prev by Date: Re: converting a preprocessor token to a string constant
- Next by Date: Re: How to apply sizeof operator on an array-of-pointers-to-functions?
- Previous by thread: Re: I don't quite understand this exercise...
- Next by thread: Re: I don't quite understand this exercise...
- Index(es):
Relevant Pages
|