add c_api example, refactored headers