Nested Functions in C - Best Practices
- by Justin Ethier
I just realized a function may be defined inside another function in C:
void main(){
int foo(){ return 2; };
printf("%d\n", foo());
}
Besides being a neat trick, the useful thing about this is that the inner function is private to the outer function. But... is that a good enough reason to do this in a "real-world" application? What are the best practices for using this syntax?