*(num+1)[1]and**(num+2)are different ways of writing the same thing. That is, the third element ofnum.- The type of
numisshort (*)[2]. That is, it is a pointer to an array of 2shortvalues.
With these two facts in mind we can work out what the code is doing. Below assumes a 32 bit system for simplicity.
num+1. Sincenumpoints to twoshortvalues, using pointer arithmetic,num+1will be 4 bytes (2 shorts) afternum.(num+1)[1]. The array index gives the second element starting fromnum+1. That means another 4 bytes pastnum+1and hence 8 bytes pastnum.- Accessing 8 bytes after
numgives exactly15.
0
solved Advance Programming in c