Pointers/addresses

Discussion in 'C' started by chemr2, Mar 31, 2009.

  1. chemr2

    chemr2 New Member

    Joined:
    Feb 16, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    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}
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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".
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice