Memory in C++ : wrong hex to decimal conversion
vvzen opened this issue · 4 comments
Chapter : Memory in C++
Paragraph : Memory structures, arrays and vectors
When it says:
So an array is just a pointer to a memory address with the only difference that, that memory address is the beginning of reserved memory enough to allocate, in our case, 10 ints. All those ints will be one after another, so when we do arr[5] we are just accessing the value that is in the memory address of our array + the size of 5 ints. If our array started in 0x0010, and ints ocupy 4 bytes, arr[5] would be 10 + 4 * 5 = 30 which in hexadecimal is 0x001E
0x0010 in hex is 16, or am I missing something?
So the correct address should be 16 + (4*5) which in hex is 0x0024
(I'm just a newbie so please forgive me if I'm wrong).
no, you are right, can you send a PR? perhaps also clear up that 0x0010 is 16 in decimal?
I'm just starting out in Git so I'll do my best.. ❗
Is this one the right workflow?
- I fork the repo
- I create a new branch in my fork
- I modify the files
- I commit the changes
- I push the changes to the master branch of ofBook
If you're just editing one file or so, you can just hit the edit button (little pencil?) of the file in question, and github will do most if that for you. You create a commit with your changes and giyhub offers you to create a pull request.
Thanks bliderbuchi, PR opened!