I am just now learning about function pointers and, as I was reading the K&R chapter on the subject, the first thing that hit me was, \"Hey, this is kinda like a closure
Most of the responses indicate that closures require function pointers, possibly to anonymous functions, but as Mark wrote closures can exist with named functions. Here's an example in Perl:
{
my $count;
sub increment { return $count++ }
}
The closure is the environment that defines the $count variable. It is only available to the increment subroutine and persists between calls.