for the follwoing program segment:
std::vector<int*> v;
{
int a=5000;
int *aa =&a;
vv.push_back(aa);
cout<<"\n"<<*(v[0]);
}
cout<<"\n"<<*(v[0]);
output:
5000
5000
my doubt here if inserting pointer to an vector ,vector should have address and while acessing it from outside of local block it should not print the elemet becuase "a" has local scope. here oject of that pointer has local scope still its accessible from outside of the scope. plese help. thanks