take string from user in character array c++ code example Example: c++ string with character array #include <cstring> strcpy(char_array, s.c_str());