vector of pointers

This is a discussion on vector of pointers within the C++ Programming forums, part of the General Programming Boards category; how do I get the value of 'a' from the vector ?
Code:
int a = 5, *b = &a;
...

I agree with you. I would totally avoid using pointers in this case, but unfortunately I am forced to

Now I discovered another inconvenience of doing this. I am now pushing more values into it. While iterating through this vector, it only prints out the last value pushed for each v[i] vector position. How to fix this ? Maybe I'm not pushing correctly and my vector has the same (last pushed) value all over ?

I agree with you. I would totally avoid using pointers in this case, but unfortunately I am forced to

Now I discovered another inconvenience of doing this. I am now pushing more values into it. While iterating through this vector, it only prints out the last value pushed for each v[i] vector position. How to fix this ? Maybe I'm not pushing correctly and my vector has the same (last pushed) value all over ?

Let me guess - you're pushing a pointer to the same value each and every time? Perhaps you should post your code so that we can see what's going on...