Copies the specified characters in a line of English to a character array and output, cannot use strncpy function,
Requirements: write a function f (char * s1, int start, int len, char * s2), * s1 character pointer to start from the first start continuous len characters copied to the character pointer * s1,
CodePudding user response:
Method has a lot of, can't use strncpy () function, use cycleVoid f (char * s1, int start, int len, char * s2)
{
int i=0;
While (len - & gt; 0)
{
[i++] s2=s1 [start++];//will correct s1, pointing to the value assigned to the correct s2 to memory
}
S2 [I]='\ 0';
}
CodePudding user response:
Void f (char * s1, int start, int len, char * s2)
{
int i=0;
While (len - & gt; 0)
{
[i++] s2=s1 [start++];//will correct s1, pointing to the value assigned to the correct s2 to memory
}
S2 [I]='\ 0';
}