I have a string that contains what ever the user has input
string userstr = "";
cout << "Please enter a string ";
getline (cin, userstr);
The string is then stored in userstr, I then want the string to be stored in a integer array where each character is a different element in the array. I have created a dynamic array as the following:
int* myarray = new int[sizeof(userstr)];
However how do I then get my string into that array?
sizeof(userstr)is not the same asuserstr.length()oruserstr.size().