10.07.2015 Views

Data Types & Type Checking - Ace

Data Types & Type Checking - Ace

Data Types & Type Checking - Ace

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.

Pointer Operations• Two fundamental operations:– assignment.– dereferencing.• Assignment is used to set a pointer variable’s value tosome useful address:– int ∗ptr = &counter; // indirect addressing.– int ∗ptr = new int; // heap-dynamic variable.• Dereferencing yields the value stored at the locationrepresented by the pointer’s value– C++ uses an explicit operation via unary operator ∗:j = *ptr; // sets j to the value located at ptrLecture 0639

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

Saved successfully!

Ooh no, something went wrong!