Answers for "can we use arr[-1] in c++ to get last array element"

C++
1

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
Posted by: Guest on September-07-2020

Code answers related to "can we use arr[-1] in c++ to get last array element"

Browse Popular Code Answers by Language