Subj : *.cpp & *.h interaction & structure To : borland.public.cpp.borlandcpp From : Alistair Date : Tue Jul 13 2004 11:26 pm When creating a normal C++ project without anything special to compilers (nothing borland / ms specific), the creation of main.cpp and main.h and , for example, xxx.cpp and xxx.h, yyy.cpp and yyy.h If i wanted to define a variable that can be accessed from each of these ..cpp files and that variable would referencing the same memory space (the same data in that space), then how would I go about it? I have looked at static variables and can see that they are useful if declared and used within the same function but If I am no working with classes or funtion specific variables that are stored in the static memory arena, then how would I create a free standing globally accessable variable? declaring a free standing static variable doesnt work, especially if that variable is a pointer to memory assigned within one function. static void *myvar; // in XXX.cpp function somefunc() { myvar = malloc(sizeof(long) * 60); } // in YYY.cpp function someYFunc() { void * ptrdata = myvar; //myvar = null } I dont really want to create a class or anything else like that (dramatic), is it possible to define a global variable and have all .cpp within a program view and use the global variable (which is free standing, i.e. not a part of a class etc...) Thanks for any help on this. Cheers Alistair .