I have a structure coord and a vector containing objects of type coord :
struct coord { int x1; int x2; }; vector<coord> v[n]; Now when I try to put something(just after vector declaration) into vector v using v[0].x1=2 then compiler gives an error saying
'class std::vector<coord, std::allocator<coord> > has no member named x1' but when I use a temp object of coord type to store coordinates, define vector like
vector<coord> v //i.e without specifying size of vector ,push it into vector and then try to access v[0].x1, it works fine.
So why I am not able to put into vector using first way but second way?