Thread: Explain me the following question took from K&R exercises?

  1. #1
    Registered User
    Join Date
    Jul 2011
    Location
    India
    Posts
    20

    Explain me the following question took from K&R exercises?

    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?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Ok, lets approach this the smart way....

    Sit down with pencil and paper, work out some of the possibilities and make sure you understand what can happen.
    Then "become the problem"... what steps do you have to take to solve this problem.
    Finally, "become the program"... what do you have to do to code your solution to the problem.

    There is no programmer on this earth who can code the solution to a problem he doesn't understand.
    However... a proper understanding of the problem almost always suggest a solution.

    Give it your best shot, post your code... lets see what we can do...

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by ackr1201 View Post
    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?
    I don't know the specifics of the question. If n comes from the user, then it has to be variable. If it doesn't, then you can use either or the other at your leisure. (This is the sort of thing that people have been arguing about for 30 years and they're not going to stop any time soon.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c++ array question please explain
    By corbinc in forum C++ Programming
    Replies: 1
    Last Post: 11-07-2009, 03:02 PM
  2. Assign. question, please explain
    By lesodk in forum C++ Programming
    Replies: 6
    Last Post: 05-17-2009, 08:53 AM
  3. can anyone explain this question for me?
    By MyRedz in forum C++ Programming
    Replies: 4
    Last Post: 02-05-2009, 06:30 AM
  4. C question explain please..
    By code_guru in forum C Programming
    Replies: 3
    Last Post: 11-04-2005, 02:54 AM
  5. Replies: 4
    Last Post: 11-19-2002, 09:18 PM