I have a string that contains what ever the user has input
string userstr = \"\"; cout << \"Please enter a string \"; getline (cin, userstr); <
string userstr = \"\"; cout << \"Please enter a string \"; getline (cin, userstr);
int* myarray = new int[ userstr.size() ]; std::copy( usestr.begin(), userstr.end(), myarray );
The terminating zero was not appended to the array. If you need it you should allocate the array having one more element and place the terminating zero yourself.