what is back() in vecto code example
Example: c++ vector.back
#include <iostream>
#include <vector>
int main()
{
std::vector<int> myvector;
//add 2 to the back
myvector.push_back(2);
std::cout << myvector.back() << std::endl; //this will print 2
myvector.push_back(46);
std::cout << myvector.back() << std::endl; //prints 46
return 0;
}
/*Output
2
46
*/