Converting between C++ std::vector and C array without copying
You can get a pointer to the first element as follows: int* pv = &v[0]; This pointer is only valid as long as the vector is not reallocated. Reallocation happens automatically if you insert more elements than will fit in the vector’s remaining capacity (that is, if v.size() + NumberOfNewElements > v.capacity(). You can use … Read more