-
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!
Code:
char input_line[81];
.
.
.
if (file_in.eof())
break;
cout << "More? (Press 'Q' and ENTER to quit.)";
cin.getline(input_line, 80);
c = input_line[0];
if (c == 'Q' || c == 'q')
break;
-
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".