Thread: array size

  1. #1
    Registered User
    Join Date
    May 2010

    array size

    Hi all, this short paragraph of code is to get the user to enter q to quit. But why is the value of c = input_line[0] zero? What is the purpose of this line? Thanks!
    char input_line[81];
     if (file_in.eof())
            cout << "More? (Press 'Q' and ENTER to quit.)";
            cin.getline(input_line, 80);
            c = input_line[0];
            if (c == 'Q' || c == 'q')

  2. #2
    Registered User
    Join Date
    Nov 2007
    Free Country, USA
    input_line[0] is the first character in the array. It does not refer to the array's size.

    If the value of input_line[0] is equal to "0", then your user is inputting "0".
    Hatman Approves!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. size of array
    By goran00 in forum C Programming
    Replies: 38
    Last Post: 04-02-2008, 09:57 AM
  2. Invalid conversion from 'void*' to 'BYTE' help
    By bikr692002 in forum C++ Programming
    Replies: 9
    Last Post: 02-22-2006, 11:27 AM
  3. Replies: 42
    Last Post: 12-19-2004, 08:59 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Type and nontype parameters w/overloading
    By Mr_LJ in forum C++ Programming
    Replies: 3
    Last Post: 01-02-2004, 01:01 AM

Tags for this Thread