cpp vector structure 1

cpp vector structure


typedef struct test1 {
  int a;
  char b;

std::vector _v;

_v.push_back((TOTO){10, 'a'});
_v[0].a = 101;

Here is what the above code is Doing:
1. Define a struct called TOTO with two members: an int and a char.
2. Define a vector of TOTO’s called _v.
3. Push a TOTO onto the vector.
4. Change the first element of the vector.

Similar Posts