I. Arrays: ========== (1) Definition of an array: a *data structure* which stores *related items* *contiguously* in memory. (2) Why do you have to declare the size of a (statically-initialized) array at compile time? Virtual program memory (and what happens with each function call) etc. (3) What is a function signature? ANS: A function's signature is a combination of the functions' return type, functions' name, the number, order, and types of its parameters; as well as any qualifiers that can be applied to the function. II. More filestream processing examples. ======================================== (1) REPEAT AFTER ME: ifstream *CLASS* and infile *OBJECT*. In the examples we did in class (readNames*.cc), the object infile is operated upon when you extract from a file stream in C++; correspondingly, you use the FUNCTION fscanf() to read from a file pointer in C. DONT CONFUSE THE TWO APPROACHES, AND RECOGNIZE THE DIFFERENCE. (2) readNames.cc: issues with infile >> name; (3) Now... suppose we wanted to print all of the names that are of maximum length. For example, in the file, there are three names of length 15 (counting the space.) No names are longer in this list. Dick Van Dyke Ben Biro Anne Martin Paul Gordon Adam Maloney Brandon Bendigo Nevin Schlabach Brian Flad Dave Bones Eric Dramstad Burke Wadsworth Mike Sciblo The suggestion is to go through the names twice; the first time we find the length of the longest name; the second time we print all names that match. readNames5.cc will do just that... IV. A debugging tip. ===================== If you get the error message: "readNames.cc", line 35: Error: Taking address of the bound function std::ios::eof() const. If you get this error, it typically means that you making a function call but forgot the (). RECALL THAT eof() is bound in scope to ifstream objects, and is a ifstream-specific function, so you should bind the appropriate scope to the object before calling it!! And, yes, eof is a function which takes no parameters, so, the right way to call it is infile.eof(). E.g. WRONG: while (!infile.eof) CORRECT: while (!infile.eof() ) The fact that eof() ends in parentheses means that it is a function call The fact that I have infile.eof() The infile. part means that eof is a "member function" of the class to which infile belongs. An emacs tip... to find the "end of the file" use escape > To jump to the start of the file, use escape <