Hello, im trying to acess the memory adress of my program using another program. How would that be possible?

I tryed this:

This is the program that contains the variable for the memory to be acessed:

Code:
#include <iostream>
#include <windows.h>


using namespace std;


int main()
{

	int* p_watk = new int(10);


	while(1)
	{
		cout <<*p_watk<<endl;
		cout <<&p_watk<<endl;
		Sleep(2000);
	}


        delete p_watk;
	return 0;

}


This is the program to acess the memory:

Code:
#include <iostream>

using namespace std;

int main()
{

	int* p = (int*)0x016FC50;


	cout <<*p;

}
Actually, All you got to do is open the first program. Then check the adress, and change 0x016FC50 to the adress you want to acess.

I tryed it, doesn't really work. Maybe the way im doing it is wrong.

This will help me to:

Save the memory adress into a file.
The "Server localhost" program will read the file, get the adress.
It will then be able to modify the value.

Thank you. If you are able to help me with that, it'll be great.