What Is a Pointer?
A pointer is a variable that holds a memory address. |
Stop. Read that again. A pointer is a variable. You know what a variable is; it is an object that can hold a value. An integer variable holds a number. A character variable holds a letter. A pointer is a variable that holds a memory address.
Okay, so what is a memory address? To fully understand this, you must know a little about computer memory. Don't panic; it isn't very difficult.
Computer memory is where variable values are stored. By convention, computer memory is divided into sequentially numbered memory locations. Each of these locations is a memory address.
Every variable ...
Get Sams Teach Yourself C++ in 24 Hours, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.