Why is this?

int kitty(GtkWidget* widget, float* foo)
{
  if(*foo != .5f)
   std::cout << "this usually occurs" << std::endl;
}
int otherFunc(void)
{
  float foo = .5f;
  //assume widget has been created
  g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(kitty), (gpointer)&foo);
}
int otherFunc(void)
{
  float foo = .5f;
  //assume widget has been created
  g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(kitty), (gpointer)&foo);
}

Wouldn't this foo be destroyed by the time the event handler kitty is called?

Also, do read up on comparing floating point values. http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm