#include <stdio.h>
void escape(char s[], char t[]);
int main(){
char t[] = "hello\twro";
char s[100];
escape(s, t);
printf("%s", s);
return 0;
}
void escape(char s[], char t[]){
int i,j = 0;
while(t[i] != '\0'){
switch(t[i]){
case '\t':
s[j]='\\';
++j;
s[j]='t';
break;
case '\n':
s[j]='\\';
++j;
s[j]='n';
break;
default:
s[j]=t[i];
break;
}
++i;
++j;
}
s[i] = '\0';
}