C++ Ch7 - Find the Errors
char greeting [] = {'H', 'e', 'l', 'l', 'o'}; cout << greeting;
A null terminator must be specified in the initialization list.
float rating [];
For the array to be implicitly sized there must be an initialization list. i.e. { blah blah blah };
int array1[4], array2[4] = {1, 2, 3, 4}; array1 = array2;
The assignment operator cannot be used to assign the contents of one array to another, in a single statement.
int hours[3] = 1, 2, 3;
The initialization list must be enclosed in braces.
int table[10]; for(int x = 0; x < 20; x++) { cout << blah blah; }
The loop will write data past the end of the array.
int size; double values[size];
The size declarator cannot be a variable.
int collection [-20];
The size declarator cannot be negative.
int num[8] = {1, , 3, 4, , 5, 6, 8};
Two of the initialization values are left out.