std::Array get first and last element code example
Example 1: get the first element of array c++
int arr = [1,2,3,4];
cout << arr[0]; //printing the first element of the array arr
Example 2: How to get the last element of an array in C++ using std::array
#include <array>
std::array<int, 5> a {1, 2, 3, 4, 5};
int i = a[a.size() - 1]; // The last variable stored in i