In-class notes for 09/21/2018
CS 251 (SD), Fall 2018
Reading questions
Operators
An operator is a function with specialized syntax for its calls.
In C++ objects, each operator (e.g.,
+
) has an alternate name (e.g.,operator+
that can be used to call that operator using ordinary function-call syntax.
Arrays
In an array, a single variable name identifies multiple memory locations of the same type
C++ code:
int arr[5]; arr[3] = 27; cout << arr[3] << endl; int arr2[] = {1, 2, 3, 4}; char s[] = "hello"; cout << arr2[3] << s[1] << endl;
Puzzles
HW7
Standard deviation formula:
Accumulator variables for loops