I have
char t[200];
cin.get(s, 200);
int i = 5;
int j = 10;
Is there any simple way to get substriing(i,j)
from t
beside copying every element seperately to the another array? No strings
etc. just char t[200]
.
char* substr(char* arr, int begin, int len)
{
char* res = new char[len + 1];
for (int i = 0; i < len; i++)
res[i] = *(arr + begin + i);
res[len] = 0;
return res;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With