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.

Dynamic Allocation<br />

double *pi = new double(3.14159);<br />

int *num = new int(); *num = 9;<br />

int *grades = new int[40];<br />

S Finds space for 40 integers, returns address of first element to int<br />

pointer grades<br />

S Memory allocated for array NOT initialized (unknown)<br />

S Remember array name is a constant pointer to 0 th element of array<br />

69

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

Saved successfully!

Ooh no, something went wrong!