Tricky pointer question

后端 未结 4 890
北荒
北荒 2021-02-07 15:17

I\'m having trouble with a past exam question on pointers in c which I found from this link, http://www.cl.cam.ac.uk/teaching/exams/pastpapers/y2007p3q4.pdf

The question

4条回答
  •  执笔经年
    2021-02-07 15:30

    pps is a pointer to a pointer. It is dereferencing pps. So now you have a pointer. As arrays are just pointers you are then using pps as an array.

    It is then same as:

    short ps[2] = {0x0001,0x034c};
    short **pps = &ps;
    

    so the result is: 0x034c

提交回复
热议问题