-7
vector<vector<double> >a(3,vector<double>(4));
double *p = a[0];

Why this is wrong, a[0] is not the address of the first dimension of a?

Bartek Banachewicz
  • 38,596
  • 7
  • 91
  • 135
tenos
  • 909
  • 1
  • 9
  • 16

1 Answers1

4

Look here

vector<vector<double> >a(3,vector<double>(4));

You defined a as a vector having 3 elements of type vector<double>. So a[0] has type vector<double>. vector is a user defined type. It is not a pointer.

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335