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