3 <style|<tuple|book|style-bk>>
9 <assign|description-aligned|<\macro|body>
10 <compound|<if|<and|<value|<merge|prefix-|description-aligned>>|<unequal|<value|last-item-nr>|0>>|list*|list>|<macro|name|<aligned-item|<item-strong|<arg|name><item-spc>>>>|<macro|name|<with|mode|math|<with|font-series|bold|math-font-series|bold|<rigid|\<ast\>>>>>|<arg|body>>
18 <\description-compact>
19 <item*|assignment>An expression in which a variable is set to a value.
20 For example, in the expression <hgroup|<cpp|x = 1>>, the variable <cpp|x>
21 is set to the value <cpp|1> because <cpp|x> is to the left of the equals
22 sign \ \P<cpp|=>\Q. The value of the entire expression is equal to the
23 value of the left hand side (i.e. <cpp|x> in this example) after the
24 assignment is performed. For example, the following C code will print
28 #include \<less\>stdio.h\<gtr\>
34 \ \ if( (c = 7) == 7 )
36 \ \ \ \ printf("true");
40 \ \ \ \ printf("false");
45 As another example, the following lines are equivalent:
50 a = ( b = ( c = 0 ) );
53 <item*|declaration<label|term declaration>>A construct that establishes
54 an association between a particular variable, function, or type and its
55 attributes. (See <hlink|cppreference.com|https://en.cppreference.com/w/c/language/declarations>
56 and <hlink|microsoft.com|https://docs.microsoft.com/en-us/cpp/c-language/c-declarations-and-definitions>).
57 Compare with <with|font-series|bold|definition>.
59 <item*|definition<label|term definition>>A construct that stablishes the
60 same associations as a declaration but also causes storage to be
61 allocated for the variable. (See <hlink|microsoft.com|https://docs.microsoft.com/en-us/cpp/c-language/c-declarations-and-definitions>).
63 <item*|delinter><label|term_delinter> A source code analysis program
64 designed to detect common syntactic errors.
66 <item*|enumeration<label|term enumeration>><hlink|Enumeration|https://en.wikipedia.org/wiki/Enumeration>
67 (or <code*|enum>) is a user defined data type in <name|C>. It is mainly
68 used to assign names to integral constants. For example, the declaration
69 <code*|enum year{Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov,
70 Dec};> allows writing a for loop with names of months <code*|for (i=Jan;
71 i\<less\>=Dec; i++)> to cycle <code*|i> through the integers <code*|0, 1,
72 2, 3, <text-dots>, 10, 11>.
74 <item*|escape sequence<label|term escape_sequence>>A set of characters
75 used to represent hard-to-type or invisible characters. Some commonly
76 used escape sequences in <name|C> include:
78 <\description-aligned>
79 <item*|<cpp|\\n>>Represents the <em|newline> character.
81 <item*|<cpp|\\t>>Represents the <em|tab> character.
83 <item*|<cpp|\\b>>Represents the <em|backspace> character.
85 <item*|<cpp|\\\\>>Represents the <em|backslash> (i.e.
86 \P<verbatim|<em|\\>>\Q) character.
87 </description-aligned>
89 All other escape sequences used in <name|C> are:
91 <\description-aligned>
92 <item*|<cpp|\\a>>Represents the <em|alert> (bell) character.
94 <item*|<cpp|\\f>>Represents the <em|formfeed> character.
96 <item*|<cpp|\\r>>Represents the <em|carriage return> character.
98 <item*|<cpp|\\t>>Represents the <em|horizontal tab> character.
100 <item*|<cpp|\\v>>Represents the <em|vertical tab> character.
102 <item*|<cpp|\\?>>Represents the <em|question mark> character.
104 <item*|<cpp|\\'>>Represents the <em|single quote> character.
106 <item*|<cpp|\\">>Represents the <em|double quote> character.
108 <item*|<cpp|\\><em|ooo>>Represents an <em|octal number> (e.g.
109 <cpp|\\012> is the <em|newline> character<\footnote>
110 <label|ref includehelp-oct-hex>See
111 <hlinkv|https://www.includehelp.com/c/octal-and-hexadecimal-escape-sequences.aspx>.
114 <item*|<cpp|\\x><em|hh>>Represents a <em|hexadecimal> number (e.g.
115 <cpp|\\x0A> is the <em|newline> character<rsup|<reference|ref
116 includehelp-oct-hex>>).
117 </description-aligned>
119 <label|term garbage_collection><item*|garbage collection>The process of
120 freeing memory allocated by a program but which is no longer referenced.
121 Usually incurs a significant <hlink|speed
122 penalty|https://en.wikipedia.org/wiki/Overhead_(computing)>.
123 (<hlink|Wikipedia|https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)>).
124 The <name|C> Language does not provide garbage collection by default.
126 <item*|<label|term heap>heap>A large pool of memory that can be used
127 dynamically \U it is also known as the \Pfree store\Q. This is memory
128 that is not automatically managed \U you have to explicitly allocate
129 (using functions such as malloc), and deallocate (e.g. free) the memory.
130 Failure to free the memory when you are finished with it will result in
131 what is known as a memory leak. Is the diametrical opposite of the stack
132 (which, by contrast, is limited not by physical memory but by a
133 CPU-determined stack size). (See <hlink|craftofcoding.wordpress.com|https://craftofcoding.wordpress.com/2015/12/07/memory-in-c-the-stack-the-heap-and-static/>).
135 <item*|<label|term machine-independent>machine-independent>A property of
136 code that does not have to be modified in order to run on a different
137 hardware architecture. (e.g. \PC is called a portable language because
138 [code written in C] will run on any machine which supports C, without
139 modifying a single line of code.\Q; <hlink|link|https://www.log2base2.com/C/basic/introduction-to-c-language.html>).
141 <item*|<label|term operand>operand>A quantity to which an operator is
142 applied. (e.g. in the <name|C> math expression <code*|7 - 4 = 3>,
143 <code*|7> is the first operand and <code*|4> is the second operand.)
145 <item*|<label|term operator>operator>A special type of function with
146 limited numbers of parameters (e.g. 1 to 2) and syntax often requiring a
147 set of characters different from those normally use for naming variables
148 (e.g. the <code*|+> character in <code*|myVar = 1 + 2>, the <code*|&&> in
149 <code*|a && b>, or the <code*|++> in <code*|i++>.).
151 <item*|<label|term stack>stack>A region of memory for global variable
152 storage and is permanent for the entire run of the program. Stack size is
153 limited not by physical memory availability but by the CPU. Lifetime of
154 local variables declared within the stack is enforced by the Last-In,
155 First-Out nature of the stack; when a function returns a value, all stack
156 memory allocated by declarations within the function is automatically
157 freed. (See <hlink|craftofcoding.wordpress.com|https://craftofcoding.wordpress.com/2015/12/07/memory-in-c-the-stack-the-heap-and-static/>)
159 <item*|<label|term struct>struct>(short:
160 <hlink|struct|https://en.wikipedia.org/wiki/struct_(C_programming_language)>)
161 a <hlink|composite data type|https://en.wikipedia.org/wiki/Composite_data_type>
162 that defines a physically grouped list of variables under one name in a
163 block of memory, allowing the different variables to be accessed via a
164 single <hlink|pointer|https://en.wikipedia.org/wiki/Pointer_(computer_programming)>
165 or by the struct declared name which returns the same address.
167 <label|term structure_assignment><item*|structure assignment>The act of
168 <hlink|assigning|https://en.wikipedia.org/wiki/Assignment_(computer_science)>
169 a <hlink|struct|https://en.wikipedia.org/wiki/struct_(C_programming_language)>
170 to another struct. (?) (<hlink|example|https://stackoverflow.com/a/2302359/10850071>)
172 <item*|<label|term text_stream>text stream>A sequence of characters
173 divided into lines; each line consists of zero or more characters
174 followed by a newline character. (See K&R 2nd Ed. Section 1.5 \PCharacter
176 </description-compact>
182 <subsection|Character Input and Output>
185 <item*|<cpp|getchar()><label|func getchar>>Read one character at a time
186 from the input buffer. Returns as <cpp|int> a <em|character
187 constant>.<\footnote>
188 <name|ASCII> characters have constants in the range <math|0-127>. UTF-8
189 characters return multiple constants (e.g. \<#B0\> returns <cpp|194
190 176>). See <hlinkv|https://www.smashingmagazine.com/2012/06/all-about-unicode-utf8-character-sets/>.
191 A strategy for reading the multiple bytes of a UTF-8 character is here:
192 <hlinkv|https://stackoverflow.com/a/34240796/>.
195 <item*|<cpp|for()>>A generalization of <cpp|while()>. Takes three
199 <item>Local statement to run before loop (e.g. to initialize a counting
202 <item>Local statement that, if evaluated as true, permits running of
203 next iteration of loop.
205 <item>Local statement to run after loop (e.g. to increment a counting
209 <item*|<cpp|putchar(int arg1)><label|func putchar>>Write one integer
210 character (e.g. <cpp|arg1>) at a time.
212 <item*|<cpp|printf()>>Used for printing formatted text to console.
214 Character codes include:
216 <\description-aligned>
217 <item*|<cpp|%d>>Used with <cpp|int> (i.e. 16-bit integers; max value of
218 <math|2<rsup|16>=32\<space\>767>).
220 <item*|<cpp|%ld>>Used with <cpp|long> (i.e. at least 32-bit
221 integers).<\footnote>
222 K&R 2nd Ed., Sec. 1.5 \PThe conversion specification <cpp|%ld> tells
223 <cpp|printf> that the corresponding argument is a <cpp|long>
227 <item*|<cpp|%f>>Used with <cpp|float> and <cpp|double> (double
228 precision <cpp|float>).
229 </description-aligned>
236 <section|Text Editor>
239 <item><name|Emacs> - GNU text editor. See
240 <hlinkv|https://www.gnu.org/software/emacs/>.
242 <item><name|Vim> - text editor See <hlinkv|https://www.vim.org/>.
247 (TODO: Insert C language linter here)
254 <associate|preamble|false>
260 <associate|auto-1|<tuple|1|?>>
261 <associate|auto-2|<tuple|1.1|?>>
262 <associate|auto-3|<tuple|1.2|?>>
263 <associate|auto-4|<tuple|1.2.1|?>>
264 <associate|auto-5|<tuple|2|?>>
265 <associate|auto-6|<tuple|2.1|?>>
266 <associate|auto-7|<tuple|2.2|?>>
267 <associate|footnote-1.1.1|<tuple|1.1.1|?>>
268 <associate|footnote-1.2.1|<tuple|1.2.1|?>>
269 <associate|footnote-1.2.2|<tuple|1.2.2|?>>
270 <associate|footnr-1.1.1|<tuple|1.1.1|?>>
271 <associate|footnr-1.2.1|<tuple|1.2.1|?>>
272 <associate|footnr-1.2.2|<tuple|1.2.2|?>>
273 <associate|func getchar|<tuple|1.2.1|?>>
274 <associate|func putchar|<tuple|3|?>>
275 <associate|ref includehelp-oct-hex|<tuple|1.1.1|?>>
276 <associate|term declaration|<tuple|assignment|?>>
277 <associate|term definition|<tuple|declaration<label|term declaration>|?>>
278 <associate|term enumeration|<tuple|delinter|?>>
279 <associate|term escape_sequence|<tuple|enumeration<label|term
281 <associate|term garbage_collection|<tuple|<with|mode|<quote|prog>|prog-language|<quote|cpp>|font-family|<quote|rm>|\\x><with|font-shape|<quote|italic>|hh>|?>>
282 <associate|term heap|<tuple|garbage collection|?>>
283 <associate|term machine-independent|<tuple|<label|term heap>heap|?>>
284 <associate|term operand|<tuple|<label|term
285 machine-independent>machine-independent|?>>
286 <associate|term operator|<tuple|<label|term operand>operand|?>>
287 <associate|term stack|<tuple|<label|term operator>operator|?>>
288 <associate|term struct|<tuple|<label|term stack>stack|?>>
289 <associate|term structure_assignment|<tuple|<label|term struct>struct|?>>
290 <associate|term text_stream|<tuple|structure assignment|?>>
291 <associate|term_delinter|<tuple|delinter|?>>
298 <vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|1<space|2spc>Definitions>
299 <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
300 <no-break><pageref|auto-1><vspace|0.5fn>
302 1.1<space|2spc>Terminology <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
303 <no-break><pageref|auto-2>
305 1.2<space|2spc>Functions <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
306 <no-break><pageref|auto-3>
308 <with|par-left|<quote|1tab>|1.2.1<space|2spc>Character Input and Output
309 <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
310 <no-break><pageref|auto-4>>