Chapter-3/3-2/escape.c
/* escape:  converts newlines and tabs into visible escape sequenes as
            it copies the string t into s */
converts newlines and tabs into visible escape sequenes as
it copies the string t into s
converts newlines and tabs into visible escape sequenes as it copies the string t into s
void escape(char s[], char t[]) {
  int i, j;
  for (i = j = 0; t[i] != '\0'; ++i) {
    switch (t[i]) {
      case '\n':
        s[j++] = '\\';
        s[j++] = 'n';
        break;
      case '\t':
        s[j++] = '\\';
        s[j++] = 't';
        break;
      default:
        s[j++] = t[i];
        break;
    }
  }
  s[j] = '\0';
}
void escape ( char s [ ] , char t [ ] ) { int i , j ; for ( i = j = 0 ; t [ i ] != ' \0 ' ; ++ i ) { switch ( t [ i ] ) { case ' \n ' : s [ j ++ ] = ' \\ ' ; s [ j ++ ] = ' ' ; break ; case ' \t ' : s [ j ++ ] = ' \\ ' ; s [ j ++ ] = ' ' ; break ; default : s [ j ++ ] = t [ i ] ; break ; } } s [ j ] = ' \0 ' ; }
escape:  converts newlines and tabs into visible escape sequenes as
it copies the string t into s
escape : converts newlines and tabs into visible escape sequenes as it copies the string t into s