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

[ad_1]

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>

[ad_2]

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