문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top