I have some code in C++ that uses an std::vector of std::strings to store an array of strings. I need to convert it into C. I thought that I would just create c versions of the functions I need (vector.back,vector.push_back,string.operator+=) but am getting lost in the double pointers. Can anybody lead me on the right track here?
Labdabeta
182
Posting Pro in Training
Featured Poster
Recommended Answers
Jump to Poststd::vector and std::string do a lot of work internally. You'd probably be better off converting the 'what' instead of the 'how'. Ask yourself what the code is trying to accomplish and write C code to do it.
Jump to PostIt's not all that difficult to do. Here's an example of push_back
const int BlockSize = 10; // allocate this number of elements at one time int MaxArraySize = 0; // initial size of the array int CurrentSize = 0; // current number of elements used in …
All 5 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
Labdabeta
182
Posting Pro in Training
Featured Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
L7Sqr
227
Practically a Master Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.