[Solved] What does ((short *)((((char *)(&arr[1]))+8))[3]=100; do?


((short *)((((char *)(&arr[1])) + 8))[3] = 100

&arr[1]:  is the address of the second int in arr (1*sizeof(int) from start).
((char *)(&arr[1])) : converts int address  to a char address
(((char *)(&arr[1])) + 8) : adds 8 bytes to the char address
((short *)((((char *)(&arr[1])) + 8)): converts the char address to a short address
((short *)((((char *)(&arr[1])) + 8))[3]: treats the short address as a beginning of an array of storts and goes to the third element in this array (3 * sizeof(short) bytes).
((short *)((((char *)(&arr[1])) + 8))[3] = 100; : assigns 100


*((short*)(((char*)arr) + 1*sizeof(int) + 8 + 3*sizeof(short))) = 100;

The size of an int varies depending on processors but is often 4 bytes.
The size of a short varies depending on processors but is often 2 bytes.

*((short*)(((char*)arr) + 18)) = 100;

3

solved What does ((short *)((((char *)(&arr[1]))+8))[3]=100; do?