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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

S Example:<br />

int boxVolume(int side) {<br />

}<br />

return side * side * side;<br />

Functions<br />

S Need to declare a function before it is used. If a function is<br />

defined later than it is used, provide function prototype at<br />

top:<br />

S int boxVolume(int);<br />

S int boxVolume(int side = 1); //can specify default <strong>parameter</strong>s<br />

13

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

Saved successfully!

Ooh no, something went wrong!