>>1Most C programs can't be written with complete avoidance of side effects (I/O is essentially reading or writing a global variable and therefore a side effect). Complete avoidance of side effects means the program can only receive input and output through the OS shell, which makes several tasks outright impossible. For example, you can't write a cowsay or text adventure in a purely functional style.
And function pointers are quite awkward to use, and cannot be cast to generic pointers without causing undefined behavior. Additionally, I'm not aware of a portable way to achieve partial function application in C. (If there was, it would be possible to emulate the this pointer, and therefore do class-oriented programming).
>>8A higher-order function is just a function that takes one or more functions as arguments, or returns a function. Both are possible in C; I used the former to write a definite integral evaluator which calculated the integral of an external unary function passed as a function pointer. Doing that without function pointers would require either placing the mathematical function within the body of the evaluation function, or implementing an expression parser. It's also possible to return a function pointer from a function, but this really only allows you to choose from a set of existing functions; constructing new functions at runtime would require an eval() function.
>>9Again, that isn't portable.
>>12That doesn't give you partial application, it just gives you a structure for storing arguments in advance before calling the function. The actual syntax for calling the function ends up being actually more verbose, you go from something like:
function(a,b,c);
to
struct closure a_closure;
a_closure.funcptr = &function;
a_closure.arg1 = a;
a_closure.arg2 = b;
a_closure.arg3 = c;
a_closure.funcptr(a_closure.arg1,a_closure.arg2,a_closure.arg3);
The verbosity makes it essentially pointless unless you're doing a lot of passing functions with pre-set arguments around.
Now in C++ you could probably achieve a cleaner closure syntax that makes partial function application easy, by using OOP and overloading the function call operator. So you could do something like
closure printIntegerWithNewLine(printf);
printIntegerWithNewLine.setArg(1, "%d\n");
printIntegerWithNewLine(51);
Which would ultimately equate to calling printf("%d\n", 51). Basically, the () operator would be overloaded to apply whatever arguments are already set, with any extra arguments taken from between the parentheses. A closure object with a N-ary argument and M arguments set could be called as a (N-M)-ary function. The same is of course true of your C closure, but the syntax is much more annoying.