A while back I wanted to write some C code that looped over every element in a collection. But I wanted the code to be parametrisable in the face of different implementations of that collection, because it might have to link against several other pieces of code which might all store the things in question in a different format.
( iteration over a collection of elephants by C switch abuse )
eta: there's a bug in the switch
-based solution above. See my follow-up post for details.