Vector with pointer type

1
2
3
Vector<int*>a;
a. pushback(new int(10)
Why not working
Last edited on
Well, maybe because you're obviously missing a parenthesis. Also, after 107 posts, use god damn code tags.
pushback should be push_back.
Vector should be std::vector.
Last edited on
And don't forget to add a semicolon after your push_back call:

1
2
std::vector<int*> a;
a.push_back(new int(10));
At this point it's 100% proven that @mike9407 is just one freaking troll. He's used vectors plenty of times in programs, including the push_back function, and now he can't even see a missing parenthesis nor a simple semicolon and randomly forgets that it's called push_back, not to mention he can't type c++ vectors in google, just proves that he's a troll.
Last edited on
I think you're right on this, @TarikNeaj. Most post are all random questions on subjects either documented in the reference or in the tutorial, and most likely caught by the compiler as well.
Those syntax error i know, most important is the understand of concept how about i use vector<int>*a;what its mean lol
1
2
vector<int *> a;  // From from first post
vector <int> *a;  // From last post 

Those are two different things. Which did you mean?

The first is a vector of pointers to ints.
The second is a pointer to a vector of ints.

You have been asked to use code tags. PLEASE DO SO.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
If you're not going to make the slightest bit of effort to make your posts readable, why should we spend the slightest bit of effort helping you?
I will not respond further until you apply code tags.
Last edited on
I already edited
Topic archived. No new replies allowed.