Thread: Paraphrase this(What does it mean?)

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    2

    Paraphrase this(What does it mean?)

    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?

    Does this mean make the tabs just regular space bar spaces instead of the '\t' escape sequence.

    What's a symbolic parameter?
    -difference between symbolic parameter?

    p.s. yes, this is from the legendary 'k&r'

  2. #2
    Registered User
    Join Date
    Mar 2011
    Posts
    2
    I honestly don't get it. I think I understand it, but i just want someone to clarify that it means what it means which is replace '\t' with the correct number of spaces? Or does it mean something else?

    'tab stops'? not sure what that is... where the tab stops when you press it?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Take a file with tabs, say
    Code:
    Mercury	Hot
    Venus	Cloudy
    Earth	Wet
    Mars	Dry
    With n = 8, it would look like this
    Code:
    Mercury Hot
    Venus   Cloudy
    Earth   Wet
    Mars    Dry
    With n = 6, it would look like this
    Code:
    Mercury     Hot
    Venus Cloudy
    Earth Wet
    Mars  Dry
    Basically, you're keeping a count of the number of characters printed on a line.
    When you see a \t, you output enough spaces until you reach the next multiple of n characters on that line.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 04-23-2006, 02:03 PM