Arduino Callback - Error (works in C++ but not arduino)

I haven't been able to figure out why this callback doesn't work in Arduino but works in C++ (dev c)..

Basically trying to pass a function as an argument to another function. I'm developing a menu on an LCD touch screen where a button should "remember" which function to call when pressed. I intend on saving those function calls to an array and calling them when appropriate.

Any suggestions? This won't compile.

typedef int (*CallbackType)(float);  

void setup() {
  Serial.begin(9600);
}

void loop() {
   DoWork(&SomeCallback);
}

void DoWork(CallbackType callback)
{
  float variable = 0.0f;
  //Call the callback with the variable, and retrieve the result
    int result = callback(variable);

  //Do something with the result
    Serial.print(result);
}

int SomeCallback(float variable)
{
  int result;
  //Interpret variable
  return result;
}

The Arduino IDE tries to simplify the programming process for beginners. One thing it does is put function prototypes at the top of your sketch, BEFORE your typedef. To work around it, don't use the typedef.

To fix it, put your own prototype below the typedef, so CallbackType is defined before its used.

typedef int (*CallbackType)(float);
void DoWork(CallbackType callback);

The IDE won’t add a new prototype if you manually put your own in.