Hello, this is just an excercise/small puzzle to try to figure out what is stored for each variable and what the pointers are pointing to. I figured this wouldn't be that difficult but I want to make sure that I am on the right track. I will put my answers in brackets. Any help appreciated. Thanks
btw. One of these will end up blank.
Using the variables and addresses below, fill in the blanks
a. ptNum = &m;
b. amtAddr = &amt;
c. *zAddr = 25;
d. k = *numAddr;
e. ptDay = zAddr;
f. *ptYr = 1987;
g. *amtAddr = *numAddr;
Variable = ptNum, Address = 500, Data stored at that address = {8096}
Variable = amtAddr, Address = 564, Data stored at that address = {16256}
Variable = zAddr, Address = 8024, Data stored at that address = 20492
Variable = numAddr, Address = 10132, Data stored at that address = 18938
Variable = ptDay, Address = 14862, Data stored at that address = {20492}
Variable = ptYr, Address = 15010, Data stored at that address = 694
Variable = years, Address = 694, Data stored at that address =
Variable = m, Address = 8096, Data stored at that address =
Variable = amt, Address = 16256, Data stored at that address =
Variable = firstnum, Address = 18938, Data stored at that address = 154
Variable = slope, Address = 20492, Data stored at that address =
Variable = k, Address = 24608, Data stored at that address = {10132}
|
Mentor
|
![]() |
| 31Mar2009,13:55 | #2 |
|
This is impossible to answer without the definitions of ptNum, m, amtAddr etc.
Also the addresses are likely to change whenever you change the code, on each run, on each compile etc, so specific values for addresses cannot be "right" or "wrong". |

