It's one of the examples in Forth. Plan 9 uses that technique in C a lot too.
This example is ramfs which creates an in memory file system (that you can mount in Unix btw, in 166 LoC)
http://swtch.com/usr/local/plan9/src/lib9p/ramfs.c
fsopen, fsread, fswrite, fscreate are C functions declared in the same source file :
Srv fs = { .open= fsopen, .read= fsread, .write= fswrite, .create= fscreate, };
It's one of the examples in Forth. Plan 9 uses that technique in C a lot too.
This example is ramfs which creates an in memory file system (that you can mount in Unix btw, in 166 LoC)
http://swtch.com/usr/local/plan9/src/lib9p/ramfs.c
fsopen, fsread, fswrite, fscreate are C functions declared in the same source file :
fs is then passed to a library which calls them as needed.