Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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
 
PREVIOUS NEXT
Tagged: #How #element #array
ADD COMMENT
Topic
Name
7+8 =