how to use pop_back in c++ on long int code example
Example 1: c++ vector pop_back
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> v1{10, 20, 30, 40, 50};
//removing elemenets
v1.pop_back(); //removes 50
v1.pop_back(); //removes 40
}
Example 2: java vector push_back
// push_back equivalent
ArrayList<int> a = new ArrayList<int>();
a.add(2); // Add element to the ArrayList.
a.add(4);
// pop_back equivalent.
a.remove(a.size()-1); // Remove the last element from the ArrayList.