Help me learn by putting this in one line.

This is the original code which works fine:

1
2
3
int* p_base = (int*)0x01E11C60;
p_next = (int*)(*p_base + 0x5b8);
*p_next = 999;


Would someone help me learn to write what it does, on one line, accurately? I know breaking it out like this is better to read, and it will ultimately get compiled as the same ASM (or close to), but I want to know how to write it on one line simply to learn order of operators, etc.

This is my current attempt which fails:

*((INT*)((INT*)(0x01E11C60))+0x5b8) = 999;
Last edited on
Start with the last statement
1
2
*p_next = 999;
p_next has the value of (int*)(*p_base + 0x5b8) so just replace p_next with (int*)(*p_base + 0x5b8) to get
1
2
*(int*)(*p_base + 0x5b8) = 999;
p_base has the value of (int*)0x01E11C60 so you can replace it the same way and get
1
2
*(int*)(*(int*)0x01E11C60 + 0x5b8) = 999;

Last edited on
So simply explained. Sometimes I guess new guys like myself need to quit over-thinking it. Very logical. Thank you, Peter87.
Topic archived. No new replies allowed.