about summary refs log tree commit diff stats
path: root/org/c/ex_03.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/c/ex_03.org')
-rw-r--r--org/c/ex_03.org47
1 files changed, 47 insertions, 0 deletions
diff --git a/org/c/ex_03.org b/org/c/ex_03.org
new file mode 100644
index 0000000..b889a2c
--- /dev/null
+++ b/org/c/ex_03.org
@@ -0,0 +1,47 @@
+* Exercise 3
+
+#+BEGIN_SRC C
+    #include <stdio.h>
+
+  int main()
+    {
+      int age = 10;
+      int height = 72;
+
+      printf("I am %d years old.\n", age);
+      printf("I am %d inches tall.\n", height);
+
+      return 0;
+    }
+#+END_SRC
+
+#+RESULTS:
+| I | am | 10 | years  | old.  |
+| I | am | 72 | inches | tall. |
+
+** printf conversion specifiers
+
++ %%,	Print a single % character
++ %c,	Convert an int to an unsigned character and print the resulting character
++ %d or %i,	Print an int as a signed decimal number
++ %u,	Print an unsigned as an unsigned decimal number
++ %o,	Print an unsigned as an unsigned octal number
++ %x,	Hexadecimal notation (using lowercase letters a-f)
++ %X,	Hexadecimal notation (using uppercase letters A-F)
++ %e,	Exponential notation (using a lowercase e as in 3.1415e+00)
++ %E,	Exponential notation (using an uppercase E as in 3.1415E+00)
++ %f,	Print a double using a decimal format like [-]ddd.ddd
++ %g,	The more compact of %e or %f, insignificant zeros do not print.
++ %G,	Same as g, but using an uppercase E
++ %s,	Print the string pointed to by a char *
++ %p,	Print a void * argument in hexadecimal (ANSI C only)
++ %n,	Store the number of characters printed at this point in the integer pointed to by the int * argument. Nothing is printed. (ANSI C only).
+
+** printf escape sequences
+
++ \n,	prints a new line
++ \b,	backs up one character
++ \t,	moves the output position to the next tab stop
++ \\,	prints a backslash
++ \",	prints a double quote
++ \',	prints a single quote
12-04 00:30:43 +0100 committer hut <hut@lepus.uberspace.de> 2014-12-04 00:30:43 +0100 change papermanager_deep_search default option to false' href='/akspecs/ranger/commit/ranger/ext/papermanager.py?id=8c987ebc72928fef34ca14e16b7d1d538610fbd4'>8c987ebc ^
1f144a8a ^
51a3f45e ^
6196b9b0 ^
9fc99fb7 ^
6196b9b0 ^
90d0eb6e ^
6196b9b0 ^
85081e15 ^
6196b9b0 ^
da59d281 ^
6196b9b0 ^
13b6d841 ^
6196b9b0 ^




90d0eb6e ^
6196b9b0 ^
9fc99fb7 ^
6196b9b0 ^
85081e15 ^
9fc99fb7 ^
85081e15 ^
9fc99fb7 ^
6196b9b0 ^
90d0eb6e ^
51a3f45e ^
d0c71b43 ^

d0c71b43 ^


90d0eb6e ^
d0c71b43 ^
85081e15 ^

d0c71b43 ^
90d0eb6e ^
51a3f45e ^
d0c71b43 ^

85081e15 ^
d0c71b43 ^
85081e15 ^

4ee16ef9 ^



85081e15 ^

feb6b88f ^




6a0b1827 ^









85081e15 ^
85081e15 ^





























d0c71b43 ^
13b6d841 ^
51a3f45e ^
13b6d841 ^



51a3f45e ^
85081e15 ^




13b6d841 ^


51a3f45e ^
13b6d841 ^

90d0eb6e ^
0f15efb7 ^
90d0eb6e ^

0f15efb7 ^
13b6d841 ^
90d0eb6e ^
13b6d841 ^


90d0eb6e ^
13b6d841 ^
85081e15 ^












1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157