V
V
vvafree2017-04-20 10:48:21
Programming
vvafree, 2017-04-20 10:48:21

How to get a value from a vector of structures?

struct Point {
    double x_a, y_a, x_b, y_b, x_c, y_c;
  };
std::vector<Point> v;

I have a function that receives a vector
func(vector& v);
This vector consists of point value structures. I need to access the value of x_a in the second structure in the vector, then to the value of x_a in the third structure.
But I have no idea how to get them.
xa = v[1.x_a] doesn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2017-04-20
@vvafree

v[1].x_a

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question