cplusplus:pointers_1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cplusplus:pointers_1 [2018/02/24 20:51] – [Pointer syntax basics] mithat | cplusplus:pointers_1 [2019/03/28 16:24] (current) – [Pointer operators] mithat | ||
---|---|---|---|
Line 11: | Line 11: | ||
===== Pointer variables ===== | ===== Pointer variables ===== | ||
- | You can think of a **pointer variable** as a variable that stores the address of some other variable. | + | You can think of a **pointer variable** as a variable that stores the base address of some other variable. |
And? | And? | ||
Line 30: | Line 30: | ||
If we were now to ask what the address of '' | If we were now to ask what the address of '' | ||
- | So, now let's say that (for whatever reason) we wanted to create a variable to store the address where '' | + | So, now let's say that (for whatever reason) we wanted to create a variable to store the address where '' |
^ Variable name ^ Memory location ^ Memory contents across all 8 bytes (64 bits) ^ | ^ Variable name ^ Memory location ^ Memory contents across all 8 bytes (64 bits) ^ | ||
Line 162: | Line 162: | ||
=== Indirection/ | === Indirection/ | ||
- | The **indirection** or **dereferencing** operator, '' | + | The **indirection** or **dereferencing** operator, '' |
<code cpp> | <code cpp> | ||
int y = -1; // declare y and initialize its value | int y = -1; // declare y and initialize its value | ||
Line 177: | Line 177: | ||
cout << y; // prints 7</ | cout << y; // prints 7</ | ||
- | Think of the indirection/ | + | You can think of the indirection/ |
- | < | + | < |
The '' | The '' |
cplusplus/pointers_1.1519505486.txt.gz · Last modified: 2018/02/24 20:51 by mithat