diff options
| author | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-02 18:34:50 +0800 |
|---|---|---|
| committer | Sadeep Madurange <smadurange@users.noreply.github.com> | 2021-12-02 18:34:50 +0800 |
| commit | 2604a140814a955893c9fd892a9d71818de06db9 (patch) | |
| tree | 32a1d85b6ee9af6b60f78bea8b1fbbdaabe653ba /3 | |
| parent | 401e5d024f88f0787d7f7f99f1d65ee91018107c (diff) | |
| download | k&r-exercises-2604a140814a955893c9fd892a9d71818de06db9.tar.gz | |
3.2
Diffstat (limited to '3')
| -rw-r--r-- | 3/2.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -5,7 +5,7 @@ #define UNESCAPE 1 #define MAXLEN 1000 -/* convert new line and tab chars to visible chars */ +/* converts new line and tab chars to visible chars */ void escape(char s[], char t[]); /* converts escapes sequences to chars */ @@ -29,17 +29,12 @@ int main(int argc, char *argv[]) { t[i] = c; t[i] = 0; - if (cmd == ESCAPE) { + if (cmd == ESCAPE) escape(s, t); - printf("Escaped output:\n"); - printf("%s\n", s); - } else if (cmd == UNESCAPE) { + else unescape(s, t); - printf("Unescaped output:\n"); - printf("%s\n", s); - } else { - return 1; - } + + printf("Output:\n%s\n", s); return 0; } |
