Addressing semantics
Introduction / Definition
Addressing semantics describes how programs refer to objects or memory locations. It is important for references, pointers, arrays, linked structures, and parameter passing. Managed languages expose references without raw pointer arithmetic. Low-level languages may expose addresses directly.
Syntax / Structure / Formula
reference โ object; pointer โ address
Detailed Explanation
If two variables refer to the same object, updates through one reference may be visible through the other. This is called aliasing.
Example
Example: Node b=a makes a and b refer to the same node object in Java.
Output / Result
A mutation through a is observable through b.
Important Points / Notes
- Understand aliasing.
- Reference assignment may not copy an object.
Mini Practice Question
What is aliasing?