copy vector to char array c++ code example Example: vector to char array c++ std::vector<int> vec {1, 2, 3}; const int* = vec.data();