How you share data depends on the type of program. You share data differently in programs that are separately compiled than you do for programs that are nested or for programs that are recursive or multithreaded.
related tasks
Sharing data in separately compiled programs
Sharing data in nested programs
Sharing data in recursive or multithreaded programs
Passing data