So if I run the latter, and then type in the decimal equivalant of the address of secure_data in the former program, and then resume the latter, the value in secure_data remains 10.
But it is supposed to change to 700, just like in the other program. Why is this?
The order of initialization of global data is undefined. For example, worked could be initialized after hide_n_sneak.
So if I run the latter, and then type in the decimal equivalant of the address of secure_data in the former program, and then resume the latter, the value in secure_data remains 10.
But it is supposed to change to 700, just like in the other program. Why is this?
Modern operating systems use virtual memory. Each process is put in an address space of its own, such that the address 0xDEADBEEF can translate to the physical address 0x00C0FFEE in one process and to 0x0CAB005E in another. This completely prevents one process from accidentally (or purposely, in your case) overwriting another process' memory.
I am probably wrong but bool Test () does not return a value.
And so is bool initialize()
Sorry if I said something stupid.
Edit: Oh sorry someone already said that.
The OS probably has system calls that let you access another process' memory. I know Windows does.
As far as I know, no system will give physical addresses to user processes. It wouldn't do any good, anyway, since there's no way for a user process to access physical memory.