I'm accessing the same memory address with two separate instances of eclipse C++ and I'm getting different results. Why is this happening?
I am running two different instances of eclipse for C++ at the same time. The first instance (Testrun.cpp) is assigning a value to the memory, then printing the memory address then stopping because it is waiting for user input. I am taking the printed memory address and assigning it to a pointer in the second instance (Hello.cpp). The second instance is accessing the memory address and not printing the integer that was assigned by the Testrun.cpp instance.
Why is this happening? I will like to write software that will access memory of another application that is running.
// Testrun.cpp
#include <iostream>
using namespace std;
int Tito(int g);
int main()
{
int l;
int *e;
int i = 11;
//int *p = (int *)0x73fe44;
e = &i;
cout << &i << endl; // prints !!!Hello World!!!
//cout << e << endl;
//*e = 4;
//int *p = (int *)0x28ff43;
//*p = 99;
//cout << i << endl;
cout << "Hello" << endl;
cin >> l;
cout << *e << endl;
return 0;
}
int Tito(int g)
{
return g;
}
// Hello.cpp
#include <iostream>
using namespace std;
int main()
{
//cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
int i = 23;
int *g;
g = &i;
*g = 232;
int *p = (int *)0x73fe40;
cout << *p << endl;
return 0;
}