Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

cpp get last element of vector

vector<int> vec;
vec.push_back(0);
vec.push_back(1);
int last_element = vec.back();
int also_last_element = vec[vec.size() - 1];
 
PREVIOUS NEXT
Tagged: #cpp #element #vector
ADD COMMENT
Topic
Name
3+7 =