arrays in function

I want to write a function that creats a 3d-vector. I don't know how I should declear the 3d-vector.

I've tried this:
vector <int> a[3];

That works fine but then I don't know how to pass them to a function that calculates the magnitude. That function is in a header file.

I hope you understand my problem and that you can give me any tips.
Do you mean a vector with three initial elements?
That is done with vector<int> a(3);
How do I access the elements of a?
Last edited on
With operator[] (e.g. a[0]).
See http://www.cplusplus.com/reference/stl/vector/
Last edited on
HI ,
what exectly do you want to do ?
because if you want to store int you only require .
vector<int> a ;
Thanks for the help, but there is more I don't understand.

Where can I read more about this?
In any decent C++ book, for example the C++ Primer:
http://www.amazon.com/Primer-4th-Edition-Stanley-Lippman/dp/0201721481
Topic archived. No new replies allowed.