Recently I found out that it is possible to pass an implicit array to a function by casting it in the function call
void foo(int* array);
foo((int[4]) {1,2,3,4});
However, I was wondering if it was possible to do the same thing when passing a function pointer to a function, so something like:
void bar(void (*foobar)(void));
bar((void) {printf("foobar\n");});
So Is it even possible to do this?
The reason I want to know is that if I have a large block of code which may have a certain loop structure, but the core functionality changes between instances, I don't want to have to litter my code with multiple temporary functions just to pass them to another function. Hence wanting to be able to define the temporary function in the parameters.
Many thanks