/*
Known strings use a chained storage structure with knots (For details, refer to linksrting. h file ),
Please write the function linkstring substring (linkstring S, int I, int Len ),
In string S, the Child string whose length is Len is obtained from position I. The function returns the child string chain table.
*/
# Include "linkstring. H"
/* Complete and test the function */
Linkstring substring (linkstring S, int I, int Len)
{
Linkstring temp;
Int J;
For (j = 0; j <I-1; j ++ ){
S = s-> next;
}
Temp = s;
While (Len --)
{
Temp = temp-> next;
}
Temp-> next = NULL;
Return S;
}
Int main ()
{Linkstring str1, str2;
Str1 = creat ();/* Create a string linked list */
Print (str1 );
Str2 = substring (str1, 3, 5);/* test, obtain the substring with a length of 5 from the first position. Please construct different test cases by yourself */
Print (str2);/* output substring */
Dellist (str1 );
Dellist (str2 );
Return 0;
}
In string S, the Child string whose length is Len is obtained from position I. The function returns the child string chain table.