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