Which of the following could you use to declare the iterator p? Why?

Suppose you want to run code that involves the loop
```
//Assume vector v and iterator p has been defined and
//given appropriate values
for (p = v.begin(); p != v.end(); p++)
cout << *p << “ “;
```

```
std::vector::iterator p;
std::vector::const_iterator p;
```


You could use either, but you probably should use const_iterator. In
the loop, the iterator p is used to fetch from the container. There is no code that
would change the container’s contents.

Computer Science & Information Technology

You might also like to view...

A(n) _________ should be used to declare the size of an array, because it makes the pro- gram more scalable.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

In addition to Design view, queries can also be created using ________

A) Datasheet view B) Layout view C) Navigation view D) SQL view

Computer Science & Information Technology

The Themes gallery is located on the ________ tab

Fill in the blank(s) with correct word

Computer Science & Information Technology

A(n) ____ is an unintended result caused by two methods running at the same time.

A. point of view B. side effect C. event trigger D. absolute direction

Computer Science & Information Technology