The internet is well not quite awash with maze generators but there certainly are plenty of them about. This one is 100% written in C.
There’s a #define, commented out by default that enables prim’s algorithm. The default is to use depth-first search instead. If you uncomment the #define movie,. it will save out the maze as a series of .bmp files.
I’ve added the link on to the C Code Links page.