Skip to content

Commit

Permalink
Fix off-by-one error in address description.
Browse files Browse the repository at this point in the history
If the addresses range from 0 to 2^30-1, there are 2^30 addresses, not 2^30-1 as the text originally said.
  • Loading branch information
Pascal-So authored May 12, 2017
1 parent 9f20a08 commit 420a5ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion first-edition/src/the-stack-and-the-heap.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ like this:
| 1 | y | 42 |
| 0 | x | → (2<sup>30</sup>) - 1 |

We have (2<sup>30</sup>) - 1 addresses in our hypothetical computer with 1GB of RAM. And since
We have (2<sup>30</sup>) addresses in our hypothetical computer with 1GB of RAM. And since
our stack grows from zero, the easiest place to allocate memory is from the
other end. So our first value is at the highest place in memory. And the value
of the struct at `x` has a [raw pointer][rawpointer] to the place we’ve
Expand Down

0 comments on commit 420a5ae

Please sign in to comment.