In what ways are pointers similar to references?
Chapter3: Data Representation
Section: Chapter Questions
Problem 14RQ
Related questions
Question
In what ways are pointers similar to references?
Expert Solution
Step 1
Introduction :
Pointers are variables that hold an address to a memory location, which points to a value of the same data type. This means that a pointer can point to a certain memory location, and the value stored at that memory location can be manipulated through a pointer.
References are similar to pointers in that they refer to an object. The difference is that references have to be initialized to an object, and they cannot be changed to refer to another object. Additionally, references cannot be null and are not addressable (meaning you cannot get the address of a reference).
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning