how to retrieve the last element of an array in cpp 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 value from array in c++
a = [1,2,3,4,5,6,7]
int x = a.size()
// last element of list
a[x-1] // ourput -> 7