I was wondering how to use a vector in a function in the following form.
batt::additem( vector <int> inv, int id );
Is that correct or will it raise errors?
Printable View
I was wondering how to use a vector in a function in the following form.
batt::additem( vector <int> inv, int id );
Is that correct or will it raise errors?
Well, you made a copy of a vector when you probably wanted a reference instead, but it should be fine.
thanks citizen!
Learn about iterators, c89c. They are a much better way to pass vectors to functions. And this is especially true when you have a big vector.