Addex exercise 1-2
authorCian Bagshaw <cian@cianb.xyz>
Fri, 25 Nov 2022 03:31:18 +0000 (03:31 +0000)
committerCian Bagshaw <cian@cianb.xyz>
Fri, 25 Nov 2022 03:31:18 +0000 (03:31 +0000)
1/2.c [new file with mode: 0644]

diff --git a/1/2.c b/1/2.c
new file mode 100644 (file)
index 0000000..c6aa94e
--- /dev/null
+++ b/1/2.c
@@ -0,0 +1,41 @@
+/*
+       Exercise 1-2. Experiment to find out what happens when printf's argument string
+       contains \c, where c is some character not listed above.
+       ===
+
+       When run together, no output is given. GCC gives many warnings, mostly stating
+       that the escape sequence is unknown. When I compile with only sequences that do
+       not draw warnings, I mostly get nothing. I believe further characters are
+       required in most sequences to make them meaningful.
+*/
+
+#include <stdio.h>
+
+int main () {
+       printf("a: \a\n");
+       printf("b: \b\n");
+       printf("c: \c\n");
+       printf("d: \d\n");
+       printf("e: \e\n");
+       printf("f: \f\n");
+       printf("g: \g\n");
+       printf("h: \h\n");
+       printf("i: \i\n");
+       printf("j: \j\n");
+       printf("k: \k\n");
+       printf("l: \l\n");
+       printf("m: \m\n");
+       printf("n: \n\n");
+       printf("o: \o\n");
+       printf("p: \p\n");
+       printf("q: \q\n");
+       printf("r: \r\n");
+       printf("s: \s\n");
+       printf("t: \t\n");
+       printf("u: \u\n");
+       printf("v: \v\n");
+       printf("w: \w\n");
+       printf("x: \x\n");
+       printf("y: \y\n");
+       printf("z: \z\n");
+}