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.

Parameter Arithmetic & <strong>Arrays</strong><br />

S int v[5]; int *vPtr = v; (or = &v[0];)<br />

location: x5000 x5004 x5008 x500c x5010<br />

vPtr<br />

v[0] v[1] v[2] v[3] v[4]<br />

S vPtr += 2; //goes from x5000 to x5008<br />

S Pointer arithmetic depends on type of pointer<br />

S cout

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

Saved successfully!

Ooh no, something went wrong!