How to use a std::vector in a C function
A C function expects an array of buffers to be in scope at runtime. e.g. char values[x][y] The C function will populate the buffers I would like to use a dynamic array so I don't have to hard code the dimensions How do I use a std::vector in this situation? Just to be clear, I am using C++. The C function is contained in a library that I cannot modify. If you just want to pass the dynamic array encapsulated in a std::vector to a c routine you can pass a pointer to the head of the underlying array as: std::vector<char> myvector; // size-up myvector as needed foo(&myvector[0]); // pass a pointer