如题,实现的就是字符串截取函数,传入字符串以及要截取的位置,返回截取后的字符串,函数如下,测试可用。
char *cutwords(char *page,int start,int end){
char *word = malloc(sizeof(char)*30);
int pos = 0;
for(int i=start;i<=end;i++){
word[pos++]=page[i];
}
word[pos] = '\0';
return word;
}