vector< vector<double> out_list.
here, inner vector contains only two elements. so my vector of vector stores values like, {{a1,b1},{a2,b2},{a3,b3},...}
i need to print out address of {a1,b1}, {a2,b2},...and so on. the addresses will be 0,1,2,3,..
I just tried with vector<int>, to print out its element address first. here is my code.
vector <int> n_list;
int main(){
for (int i=0; i<11; i++){
int x=3*i;
n_list.push_back(x);
}
vector <int>::iterator a;
for (a=n_list.begin();a!=n_list.end();a++){
cout<<&(*a)<<" ";
}
}
i got wrong output and it was
0x3e2500 0x3e2504 0x3e2508 0x3e250c 0x3e2510 0x3e2514 0x3e2518 0x3e251c 0x3e2520
0x3e2524 0x3e2528.
but, output should be like 0 1 2 3 4 ....
so, how can i print out element address of vectors?
then, i need to implement the same for vector of vector. hope your help.

New Topic/Question
Reply




MultiQuote



|