在字符串s的第n个字符后面插入字符串t

这是我们课件上的一道题,我觉得很巧妙,所以就摘出来了:

int insert(char s[],char t[],int n){
    
    
	strcat(t,s+n);
	s[n]='\0';
	strcat(s,t);
	return n;
}

猜你喜欢

转载自blog.csdn.net/yuanren201/article/details/105441829