Thread: effect of following code

  1. #1
    Registered User
    Join Date
    Oct 2002

    effect of following code

    What is the effect of following piece of code?

    char ch;
    while ((Ch = getchar()) != '\n')
    putchar (' ');

    a. It reads and writes exactly one line with a blank after each character
    b. It reads one line but ouputs only blanks
    c. It reads a line and then outputs one blank
    d. It reads and writes one line with all blanks replaced by newlines.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    e) It won't compile because 'Ch' is undefined, first used in line ...

    Hope is the first step on the road to disappointment.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    >>What is the effect of following piece of code?
    Why not compile and run it yourself, after fixing the problem highlighted by quzah. You'll learn a lot by trying things yourself first.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proposal: Code colouring
    By Perspective in forum A Brief History of
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  2. Choosing a compiler
    By pushingsquares in forum Game Programming
    Replies: 27
    Last Post: 12-14-2006, 10:33 AM
  3. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM