Question

Assume that the array named items contains the integer values 0, 2, 4, 6 and 8. Which of the following set of statements uses the range-based for loop to display each value in items?
a. for (int i = 0; i <items.size(); ++i) {
cout <<items[i] <<endl;
}
b. for (int item : items) {
cout <<items[item] <<endl;
}
c. for (int item : items) {
cout <<item <<endl;
}
d. for (int item : items.size()){
cout <<item <<endl;
}

Answer

This answer is hidden. It contains 51 characters.