23.03.2013 Views

Arrays, parameter passing, pointers and dynamic allocation. - ELIS

Arrays, parameter passing, pointers and dynamic allocation. - ELIS

Arrays, parameter passing, pointers and dynamic allocation. - ELIS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Passing <strong>Arrays</strong> to Functions<br />

S <strong>Arrays</strong> are passed by reference<br />

S Name of array is the address in memory of the 1 st element<br />

S Need to pass size too – unlike Java<br />

S Use const to make sure function can’t change array<br />

S void cannotModifyArray(const int b[]);<br />

43

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!