1
0
mirror of https://github.com/krislamo/knrc.git synced 2024-09-19 21:00:35 +00:00

Exercise 1-10. replace with escape codes

This commit is contained in:
Kris Lamoureux 2021-11-11 23:30:43 -05:00
parent a8ca4de90f
commit d8a70f8b58
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
2 changed files with 21 additions and 1 deletions

17
08-unambiguous.c Normal file
View File

@ -0,0 +1,17 @@
#include <stdio.h>
int main()
{
int c;
while ((c = getchar()) != EOF) {
if (c == '\t')
printf("\\t");
else if (c == '\b')
printf("\\b");
else if (c == '\\')
printf("\\\\");
else
printf("%c", c);
}
}

View File

@ -1,4 +1,4 @@
all: hello mathvars c2f input count countlines blanks
all: hello mathvars c2f input count countlines blanks unambiguous
hello: 01-hello-world.c
gcc -o ./bin/01-helloworld 01-hello-world.c
@ -21,5 +21,8 @@ countlines: 06-line-count.c
blanks: 07-extra-blanks.c
gcc -o ./bin/07-extra-blanks 07-extra-blanks.c
unambiguous: 08-unambiguous.c
gcc -o ./bin/08-unambiguous 08-unambiguous.c
clean:
$(RM) ./bin/*-*