switch from C++ to c99 C