This is an implementation of a gap buffer written in C. I was going to use it for a project (I still might) but am providing it for anyone else interested. It's released under an MIT-style license.
GapBuffer.hGapBuffer.c
main.c
The test harness (main.c) is written for Windows,
so it uses <conio.h> and _getch(). This can easily
be fixed for Un*x OSs, though.