v4 is a vector, the loop is to iterate through the vector list and display the elements in the vector. what does the expression inside the for loop means.
the code is as follows:
This is a range-based for loop . It iterates over all the elements of the v4
vector, and lets you process via the item
variable in each iteration.
It iterates through the container v4, whatever that is, let's say it's a vector The & in "int&" means that it's a reference, if you change the item, it's gonna change the value in the as well. Similar to
for (int i = 0; i < v4.size(); i++){
item = v4[i];
//...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.