[Solved] How to assign string a char array that starts from the middle of the array?


i think you want like this..

string s="";
for(int i=strlen(name)-1;i>=0;i--)
{
 if(name[i]==' ')break;
else s+=name[i];
}
reverse(s.begin(),s.end());

Need to

include<algorithm>

solved How to assign string a char array that starts from the middle of the array?