Pointer Variables and Dynamic Allocation







Pointers: The Problem





Pointers - The Problem



The Solution



Terminology





Introduction: Box Example





Java References: Class Box



Start with type Box



Now Introduce Type BoxPtr



Refer to the Entire Box, with .all



Some Things Never Change ...



Some Strong Typing



Can .all can be Omitted?



Sometimes .all is Required



Type BoxPtr: Another Example



Some Practice and Strong Typing





One Type in Java vs Two in Ada





Java and the Object Referenced



Java Comparison: Two Types vs One



Java Terminology: Two Types vs One





Dynamic Structures and Linked Lists





Problem and Solution



Dynamic Stacks and Queues



Types for Linked Structures - Version 1



Types for Linked Structures - Version 2



Making a List





Dynamic Stacks and Queues





A Dynamic Stack



An Empty Stack



A Dynamic Queue



Code for Dynamic Stacks and Queues



Class Exercises for Linked Structures





More Uses of Pointers





Pointers - The Problem - Revisited



Example Uses of Pointer



Accessing a Single Copy of a Value



Pointers to Arrays and Strings