c - Tricky pointer question -


I have trouble in the previous exam questions on points obtained from this link,

It is:

The AC programmer is working with a small-endian machine with 8 bits in one word and 4 bytes in one word. The compiler supports unreachable access and uses 1, 2 and 4 bytes so that four, miniature and interest stores can be stored respectively. Programmer writes the following additive (bottom right) to use the values ​​in the following memory (bottom left):

Address byte offset

-0 - 1 - 2- - 3
0x04 | 10 00 00 00 - 0x08 | 61 72 62 33 | 0x0c | 33 00 00 00 | 0x10 | 78 0c 00 00 | 0x14 | 08 00 00 00 | 0x18 | 01 00 4cx 03x | 0x1c | 18 00 00 00

  int ** i = (int **) 0x04; Small ** pps = (small **) 0x1c; Structure i2c {int i; Four * C; } * P = (straight I2c *) 0x10;   

(A) Write values ​​for the following expressions:

  ** i p-> gt [2] & amp; (* Pps) [1] ++ p- & gt; I   

I got

  ** i == 0xc78 p-> C [2] == '62' ++ p- & gt; I == 0x1000000   

I do not understand the third question ( & amp; (* pps) [1] ), can someone please explain what is here Used to be? I understand that the PPS pointers have been assigned but then the address of the operator has been applied to the value. It is not like asking about a consistency, for example if I did this

  int i = 7; Int * p = & amp; I; & Amp; (* P) ​​// would that mean 7?   

Thanks in advance for any help [] operator takes over

[] / code> operator then get the first element of an array of code pps to short * Is for. Since this element is also an indicator, we can consider it as an array and see the element at a place which indicates it, wth [1] . Finally, we get to know that element.

It may be useful to note that & amp; P [i] as p + i - this indicates the status of i where p > The intermediate values ​​are:

  pps == 0x1c * pps == 0x18 & amp; (* Pps) [1] == * PPS + 1 == 0x1A   

( +1 adds two bytes because it's a short * is used on

Comments