Cout endl display all element showallelementsmyarray

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: : showAllElements(myArray, N); ... Hello } 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

Ask a homework question - tutors are online