Editting Memory Addresses?
I was wondering how I could modify memory addresses.
ie. I've been creating a static int, printing the memory address, then going back to the program and seeing if I can assign another int that memory address.
Code:
int main()
{
int Init;
int anInt;
cout << &Init;
&anInt = *address_of_Init_here; //ie. 0x22ff7c
cin.get();
}
I was wondering because the free store (memory thats allocated until deallocated: new/delete) is supposedly non-accessible from outside the function its declared in.. but would this get around it?
However I get the normal error: non-lvalue in assignment (and if I dont get that, I get a invalid conversion error).
Also, anyone know if you can modify memory addresses from outside the program using them? I'm going to assume you can, if theres a way around non-lvalue error. So would allocating to the free store prevent this?