Thread: a simple question. plz help

  1. #1
    Registered User
    Join Date
    Mar 2008

    Question a simple question. plz help

    i need to write a program that reads input character strings form the keyboard and prints them in reverse order
    .... i know how to do the 2nd part ( print the numbers in reverse order ) but i dont know how to write a program which reads inputs for this array because the size of array in unknown , and i guess the program should also know when the inputs are finished and it has to print them in reverse order
    plzzz somebody help me

  2. #2
    Beautiful to C Aia's Avatar
    Join Date
    Jun 2007
    An option would be to declare a reasonable size array and use a function that would read from the keyboard up to that limit - 1.

    char input[255] = { '\0' };
    fgets( input, sizeof( input ), stdin );
    Check that input is successful and clear the stdin of unwanted characters if necessary.
    When the eagles are silent, the parrots begin to jabber. ~Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple question regarding variables
    By Flakster in forum C++ Programming
    Replies: 10
    Last Post: 05-18-2005, 08:10 PM
  2. Simple class question
    By 99atlantic in forum C++ Programming
    Replies: 6
    Last Post: 04-20-2005, 11:41 PM
  3. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 09:46 AM
  4. simple question.
    By InvariantLoop in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2005, 12:15 PM
  5. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM