#include <vector>
int main() {
std::vector<int> myVector = { 666, 1337, 420 };
size_t size = myVector.size(); // 3
myVector.push_back(399); // Add 399 to the end of the vector
size = myVector.size(); // 4
}
vectorName.size();
vector<int> a;
//to directly find the size of the vector;
//use a.size(;
cout <<" " << a.size();
size() function is used to return the size of the vector container or the number of elements in the vector container.
using namespace std;
int main(){
vector<int> myvector{ 1, 2, 3, 4, 5 };
cout << myvector.size();
return 0;
}
//Output = 5