Re: I don't quite understand this exercise...
- From: "Patrick M." <noone@xxxxxxxxxxx>
- Date: Mon, 26 Sep 2005 15:23:36 -0400
Thad Smith wrote:
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
Ok, thanks, and everyone else. So what you're saying is, they want me to ask the user/get and set a variable, say n, and replace all tabs with n spaces, and they don't want me to calculate the number of spaces a tab takes up on the system?
Thanks for all the replies.
-- Patrick M. /* EOF */ .
- Follow-Ups:
- Re: I don't quite understand this exercise...
- From: Roberto Waltman
- Re: I don't quite understand this exercise...
- From: Gordon Burditt
- Re: I don't quite understand this exercise...
- References:
- I don't quite understand this exercise...
- From: Patrick M.
- Re: I don't quite understand this exercise...
- From: Thad Smith
- I don't quite understand this exercise...
- Prev by Date: Re: visibility of variable
- Next by Date: Re: visibility of variable
- 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
|