Let’s say you have:
void *a = //some address;
*((int **)(char*)a) = 5
I’m not really clear on what the second line is supposed to be doing… I know that ‘a’ is casted to a pointer to a char, and then eventually casted to a pointer to a pointer to an int, but it was unclear what dereferencing a pointer to a pointer to an int actually does…
This would be very helpful. Thanks
it is storing the value 5 in “some address”, but more precisely, it is storing the value 5 widened to the machine address size in those many bytes starting at “some address”.
e. g. if it is a 64-bit machine, it is storing the value 0x0000000000000005 at the 8 bytes starting at “some address”
i don’t see why it is doing it in such a complicated way, but who are we to judge the intentions of a programmer hard at work at the end of a long day.