字符串:设计在顺序存储结构上实现求子串算法。

void substring(char s[ ], long start, long count, char t[ ])
{
	long i,j,length=strlen(s);
	if (start<1 || start>length) 
		printf("The copy position is wrong");
	else if (start+count-1>length) 
		printf("Too characters to be copied");
	else{ 
		for(i=start-1,j=0; i<start+count-1;i++,j++) 
			t[j]=s[i]; 
		t[j]= '\0';
	}
}
全部评论

相关推荐

不愿透露姓名的神秘牛友
06-27 20:55
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务