repo.or.cz
/
KandRexercises.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
changed comments for clarity
[KandRexercises.git]
/
charreplace.c
blob
8da79228c6157944bfe66074350cb1e46a6d586a
1
#include <stdio.h>
2
/* exercise 1-10: replace, \, backspace and tab characters */
3
4
main
() {
5
int
c
;
6
7
while
((
c
=
getchar
()) !=
EOF
) {
8
if
(
c
==
'
\t
'
) {
9
putchar
(
'
\\
'
);
10
putchar
(
't'
);
11
}
12
if
(
c
==
'
\\
'
) {
13
putchar
(
'
\\
'
);
14
putchar
(
'
\\
'
);
15
}
16
if
(
c
==
'
\b
'
) {
17
putchar
(
'
\\
'
);
18
putchar
(
'b'
);
19
}
20
}
21
putchar
(
'
\n
'
);
22
}