Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
If you were given this project, your book or a lecture should have covered how to pass around an array. Assuming a c-style array and not a std::vector, the name of the variable is actually a pointer to the base of the array. So all you need to do is use this name as a parameter to your functions (the type of the parameter will be int *). In the function you can use [] to subscript the array, and can assign to and from positions in the array this way.

As for how to declare this variable in main... If you have a known max number of items, you can just say:
Code:
int list[46];
if you need to dynamically allocate, you'd declare:
Code:
int *list;
...
list = new int[w];

passing around list means passing around apointer to memory that can be updated.

-Lee
 
I agree with Lee; arrays or vectors should have been covered before you got this assignment. Please give us some more detail as to which you're using.

And I certainly hope it's vector; otherwise you have the bad luck of being stuck in a C course where the instructor thought "Let's use cout instead of printf and call it C++".

That does not bode well.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.