I\'ve been thinking a lot lately about how to go about doing functional programming in C (not C++). Obviously, C is a procedural language and doesn\'t really support f
You can use GCC's nested functions to simulate lambda expressions, in fact, I have a macro to do it for me:
#define lambda(return_type, function_body) \
({ \
return_type anon_func_name_ function_body \
anon_func_name_; \
})
Use like this:
int (*max)(int, int) = lambda (int, (int x, int y) { return x > y ? x : y; });