I will put the address that has shown in previous program as input. But i got the access violation error. Is there a way to tell the program to trust the other one? If not how can i do such a thing?
You can't do stuff like you described because that's an obvious security problem. The OS will not allow it. The above example probably shows something like setting up an area of memory during runtime that's accessible from other locations through shared memory. There might also be some funky linkage hack you could find as well although I'm not sure.
Also my best friend, Boost Libraries, has a nifty little library just for this task: http://www.boost.org/doc/libs/1_47_0/doc/html/interprocess.html (or more specifically: http://www.boost.org/doc/libs/1_47_0/doc/html/interprocess/some_basic_explanations.html#interprocess.some_basic_explanations.sharing_information )
If you want more massive functionality, I would probably just use sockets and a basic protocol.