size in vector c++ code example
Example 1: cpp vector structure
#include <vector>
typedef struct test1 {
int a;
char b;
} TOTO;
std::vector<TOTO> _v;
_v.push_back((TOTO){10, 'a'});
_v[0].a = 101;
Example 2: declare vector of size n in c++
#include <vector>
auto n = 20
// create a vector with n=20 integer elements
std::vector<int> arr(n);