Unformatted text preview: : showAllElements(myArray, N);
24/07/11 11 24/07/11 passArray.cpp 12 Pass array by ref or val?
ì ì Vectors vs Arrays Passing an array to a function passes
the memory address of the array. ì Vectors often more flexible than arrays:
: This behaves very much like pass-by-reference.
: It is not a copy of the array: it is the real thing.
: Changes to the array in the function affect
the original array. Can resize them while program is running.
Can "ask" them how many elements they have.
(Neither of these are possible with arrays.) modArray.cpp 13 Vectors are great for storing data when...
you don't know how much data you will have. ì 24/07/11 ì Arrays are built-in...
View Full Document
- Spring '08