1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
// array::back
#include <iostream>
#include <array>
int main ()
{
std::array<int,3> myarray = {5, 19, 77};
std::cout << "front is: " << myarray.front() << std::endl; // 5
std::cout << "back is: " << myarray.back() << std::endl; // 77
myarray.back() = 50;
std::cout << "myarray now contains:";
for ( int& x : myarray ) std::cout << ' ' << x;
std::cout << '\n';
return 0;
}
| |