In your original functions, I would pass the std::vectors by reference, not by value. If a value is not expected to change, apply a const modifier to the argument. Now the compiler will warn you if you try to change it. Do not use the same name for your data members as the function parameter that is being used to manipulate it; you are just asking for confusion.
In general, converting this kind of C++ code to C would need you to:
- Convert all class definitions to struct definitions (simple enough).
- Redefine any member function into a regular function, taking your struct instance as a parameter, maybe a pointer to the struct instance if you need to modify the original struct.
- Remove all constructors and destructors. The beautiful automatic allocation and clean-up provided by these member functions must be managed seperately in C.
- All local variable declarations must be at the beginning of your functions, before any executable statements. In C++ you can declare variables and objects anywhere inside the function, even inside flow-control structures like loops.
- public member functions should be declared in a header (.h) file so they can be #include'd in other source files in your project.
- private or protected member functions should be declared only in the source (.c) file with a static modifier to indicate that the function can not be called outside of that source file.
- cout >> calls get converted to puts() and printf() calls. The ...