To solve the ~
CodePudding user response:
One copy to a character subsCodePudding user response:
Bool fun (char * s, int start, int len, char * & amp; Subs){
If (s==NULL)
return false;
Char * STR=s;
Int nCount=0;
While (* str++!=NULL)
+ + nCount;
If (start + len & gt; NCount)
return false;
If (subs==NULL)
{
Subs=s + start;
}
The else
{
STR=s + start;
for (int i=0; i
Subs [I]=STR [I];
}
Subs [len]=0;
}
return true;
}
Int main ()
{
Char sub [100].
Char * psub=sub;
Fun (" this is the test string!" , 3, 5, psub);
system("pause");
return 0;
}