How to implement interprocess communication (two apps sending data back and forth) depends on the operating system.
Interprocess Communications ( Windows )
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v=vs.85).aspx
Interprocess communication on Mac OS X
https://lists.apple.com/archives/cocoa-dev/2003/Jan/msg01952.html
(I can't guarantee the validity of this information, I don't use a Mac.)
PDF Interprocess Communication - Advanced Linux Programming (PDF)
http://advancedlinuxprogramming.com/alp-folder/alp-ch05-ipc.pdf
(I don't use Linux)
Note I'm using a file to keep track of which memory address one would like to access.
Also the file locations might need to be changed for you and also you need the window name to access the process handler that stores the variable.
Interprocess communication, which by looking at what rabster wrote is WAY easier in Unix.
Or you can write to a file. The name of the variable you use can be the filename. This idea is the most simple, but is really slow and I suggest you don't do it.