How to pass a dynamic 2D array from C++ to C as void *
<p>A function written in C e.g.</p>

<pre><code>extern "C" void cityManipulator( void * data, int size);
</code></pre>

<p>takes an array similar to this,</p>

<p>Shanghai, China, 17<br>
Delhi, India, 16<br>
Cairo, Egypt, 7<br></p>

<p>It then capitalizes the city names and multiplies the population number by a one million.
The function works with the value that I pass not the copy.
<br>
The function requires to know the dimensions of the array: how many rows and columns and the size in bytes of each element ( i.e. each city name ) in a given column
<br>
I am not interested in how the C function works but I want to use it as is from C++.<br>
The array has to be dynamic i.e. the columns and rows ara not static.</p>

<p>How should my data structure that I need to pass to this fucntion look like?</p>

<p>This is my attempt. Use a nested vector of boost::variant</p>

<pre><code>typedef boost::variant&lt;std::string, int&gt; Var;
typedef std::vector&lt;Var&gt; OneRow;
std::vector&lt;OneRow&gt; theArray;
</code></pre>

<p>But I can't figure out how to pass <code>theArray</code> to <code>cityManipulator( void *d ).</code><br>
<code>&amp;theArray[0]</code> <br>does not work.</p>
