Why I can't draw with TH1F(not TH1F pointer)?

Hi,
When I try to draw from TH1F, I just get a blank canvas. Here’s the code(run as macro). But when I try to draw with TH1F pointer it will be OK. I don’t know why this happens.

TCanvas *canvas=new TCanvas("canvas","",5); canvas->cd(); TH1F temp1("1","",100,0,100); temp1.Fill(50); temp1.Draw();

Thanks,
Zhaozhou

Try:
temp1.DrawCopy();
or use a heap-based object:
TH1F *temp1 = new TH1F(“h1”,"",100,0,100); // the “name” should look like a C/C++ identifier