#include
//复制拷贝s1到s2;
void changecopy(char *s1,char *s2){
int p1,p2;
for(p1=p2=0;s1[p1]!=0;p1++,p2++){
if (s1[p1]=='\n'){
s2[p2++]='\\';
s2[p2]='n';
}
else if (s1[p1]=='\t'){
s2[p2++]='\\';
s2[p2]='t';
}
else s2[p2]=s1[p1];
}
s2[p2]=0;
}
int main(){
char s1[]="hello\n,hello\t,hello";
char s2[100];
printf("s1=%s\n",s1);
changecopy(s1,s2); //复制拷贝s1到s2;
printf("s2=%s\n",s2);
}