int counter=0; void prog(void) { TH1F h2; h2=getH(); TH1F h3; h3=getH(); } TH1F getH(void) { // write out adress of h1 // in C++ this must not work because 'h1' is not defined yet!! if (counter>0) { cout << h1 << endl; } // create new histogramm as object, not pointer int size=100; TH1F h1("h1","h1",size,1,size+1); for (int i=1;i