C++ Ch7 - Find the Errors

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

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.


Ensembles d'études connexes

ch 13 Digital and social media marketing

View Set

LUOA 9th Grade English Module 6 Study Guide

View Set

Chapter 24: Renal System and Long-Term Blood Pressure Regulation

View Set

Chapter 7: Antitrust Law in the Environment of Business

View Set

Geology 107 Exam - Queens University (2nd Half)

View Set

PrepUs for Pediatrics Chapter 26

View Set