C is probably the only language you can do this in (except maybe Forth). Other languages either have no way of doing this, or don't treat data and code differently. (Feel free to add examples for other languages here.)
int foo(char *x) {
printf("%s",x);
}
func_t p = foo; return p("Narf!");
And you need to do this why?
1. Jon was using it to "compile" something then jump to it in C, by casting an array as a function, then calling it. 2. I use it frequently to do things like have a lookup table of name to function. For example in ircu, theres a functino called "parse" which takes a line from a user, splits it up into a function and it's arguments, then scans through a table of functions and their names, when it finds one that matches that command, it calls the function with the arguments it parsed earlier. Nice 'n zippy.
2 pages link to CastingPointerToFunction: