You can see an example of a C++ class to maintain a B-Tree. Even in some SQL databases, a B-Tree structure is used to hold the data internally . A good example of an embedded DB (ie one that links into your code rather than running as an external server) written in C is HamsterDB, a cross platform. Dual licensed under GPL or commercial license.
Note for non SQL DBs the approach to using the DB is quite different than that of SQL. It's more about retrieving records using a matching key and then doing updates or retrieving data. HamsterDB comes with a number of example programs to get you up and running. At my last job, the database there was Faircom's C-Tree and it was also a B-tree type database though commercial not open source. These types of databases are very fast but much better suited to single user rather than multi user applications.
- Link to C Code Library