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*|declaration<label|term declaration>>A construct that establishes
20 an association between a particular variable, function, or type and its
21 attributes. (See <hlink|cppreference.com|https://en.cppreference.com/w/c/language/declarations>
22 and <hlink|microsoft.com|https://docs.microsoft.com/en-us/cpp/c-language/c-declarations-and-definitions>).
23 Compare with <with|font-series|bold|definition>.
25 <item*|definition<label|term definition>>A construct that stablishes the
26 same associations as a declaration but also causes storage to be
27 allocated for the variable. (See <hlink|microsoft.com|https://docs.microsoft.com/en-us/cpp/c-language/c-declarations-and-definitions>).
29 <item*|enumeration<label|term enumeration>><hlink|Enumeration|https://en.wikipedia.org/wiki/Enumeration>
30 (or <code*|enum>) is a user defined data type in <name|C>. It is mainly
31 used to assign names to integral constants. For example, the declaration
32 <code*|enum year{Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov,
33 Dec};> allows writing a for loop with names of months <code*|for (i=Jan;
34 i\<less\>=Dec; i++)> to cycle <code*|i> through the integers <code*|0, 1,
35 2, 3, <text-dots>, 10, 11>.
37 <item*|escape sequence<label|term escape_sequence>>A set of characters
38 used to represent hard-to-type or invisible characters. Some commonly
39 used escape sequences in <name|C> include:
41 <\description-aligned>
42 <item*|<cpp|\\n>>Represents the <em|newline> character.
44 <item*|<cpp|\\t>>Represents the <em|tab> character.
46 <item*|<cpp|\\b>>Represents the <em|backspace> character.
48 <item*|<cpp|\\\\>>Represents the <em|backslash> (i.e.
49 \P<verbatim|<em|\\>>\Q) character.
50 </description-aligned>
52 All other escape sequences used in <name|C> are:
54 <\description-aligned>
55 <item*|<cpp|\\a>>Represents the <em|alert> (bell) character.
57 <item*|<cpp|\\f>>Represents the <em|formfeed> character.
59 <item*|<cpp|\\r>>Represents the <em|carriage return> character.
61 <item*|<cpp|\\t>>Represents the <em|horizontal tab> character.
63 <item*|<cpp|\\v>>Represents the <em|vertical tab> character.
65 <item*|<cpp|\\?>>Represents the <em|question mark> character.
67 <item*|<cpp|\\'>>Represents the <em|single quote> character.
69 <item*|<cpp|\\">>Represents the <em|double quote> character.
71 <item*|<cpp|\\><em|ooo>>Represents an <em|octal number> (e.g.
72 <cpp|\\012> is the <em|newline> character<\footnote>
73 <label|ref includehelp-oct-hex>See
74 <hlinkv|https://www.includehelp.com/c/octal-and-hexadecimal-escape-sequences.aspx>.
77 <item*|<cpp|\\x><em|hh>>Represents a <em|hexadecimal> number (e.g.
78 <cpp|\\x0A> is the <em|newline> character<rsup|<reference|ref
79 includehelp-oct-hex>>).
80 </description-aligned>
82 <label|term garbage_collection><item*|garbage collection>The process of
83 freeing memory allocated by a program but which is no longer referenced.
84 Usually incurs a significant <hlink|speed
85 penalty|https://en.wikipedia.org/wiki/Overhead_(computing)>.
86 (<hlink|Wikipedia|https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)>).
87 The <name|C> Language does not provide garbage collection by default.
89 <item*|<label|term heap>heap>A large pool of memory that can be used
90 dynamically \U it is also known as the \Pfree store\Q. This is memory
91 that is not automatically managed \U you have to explicitly allocate
92 (using functions such as malloc), and deallocate (e.g. free) the memory.
93 Failure to free the memory when you are finished with it will result in
94 what is known as a memory leak. Is the diametrical opposite of the stack
95 (which, by contrast, is limited not by physical memory but by a
96 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/>).
98 <item*|<label|term machine-independent>machine-independent>A property of
99 code that does not have to be modified in order to run on a different
100 hardware architecture. (e.g. \PC is called a portable language because
101 [code written in C] will run on any machine which supports C, without
102 modifying a single line of code.\Q; <hlink|link|https://www.log2base2.com/C/basic/introduction-to-c-language.html>).
104 <item*|<label|term operand>operand>A quantity to which an operator is
105 applied. (e.g. in the <name|C> math expression <code*|7 - 4 = 3>,
106 <code*|7> is the first operand and <code*|4> is the second operand.)
108 <item*|<label|term operator>operator>A special type of function with
109 limited numbers of parameters (e.g. 1 to 2) and syntax often requiring a
110 set of characters different from those normally use for naming variables
111 (e.g. the <code*|+> character in <code*|myVar = 1 + 2>, the <code*|&&> in
112 <code*|a && b>, or the <code*|++> in <code*|i++>.).
114 <item*|<label|term stack>stack>A region of memory for global variable
115 storage and is permanent for the entire run of the program. Stack size is
116 limited not by physical memory availability but by the CPU. Lifetime of
117 local variables declared within the stack is enforced by the Last-In,
118 First-Out nature of the stack; when a function returns a value, all stack
119 memory allocated by declarations within the function is automatically
120 freed. (See <hlink|craftofcoding.wordpress.com|https://craftofcoding.wordpress.com/2015/12/07/memory-in-c-the-stack-the-heap-and-static/>)
122 <item*|<label|term struct>struct>(short:
123 <hlink|struct|https://en.wikipedia.org/wiki/struct_(C_programming_language)>)
124 a <hlink|composite data type|https://en.wikipedia.org/wiki/Composite_data_type>
125 that defines a physically grouped list of variables under one name in a
126 block of memory, allowing the different variables to be accessed via a
127 single <hlink|pointer|https://en.wikipedia.org/wiki/Pointer_(computer_programming)>
128 or by the struct declared name which returns the same address.
130 <label|term structure_assignment><item*|structure assignment>The act of
131 <hlink|assigning|https://en.wikipedia.org/wiki/Assignment_(computer_science)>
132 a <hlink|struct|https://en.wikipedia.org/wiki/struct_(C_programming_language)>
133 to another struct. (?) (<hlink|example|https://stackoverflow.com/a/2302359/10850071>)
135 <item*|<label|term text_stream>text stream>A sequence of characters
136 divided into lines; each line consists of zero or more characters
137 followed by a newline character. (See K&R 2nd Ed. Section 1.5 \PCharacter
139 </description-compact>
145 <subsection|Character Input and Output>
148 <item*|<cpp|getchar()><label|func getchar>>Read one character at a time
149 from the input buffer. Returns as <cpp|int> a <em|character
150 constant>.<\footnote>
151 <name|ASCII> characters have constants in the range <math|0-127>. UTF-8
152 characters return multiple constants (e.g. \<#B0\> returns <cpp|194
153 176>). See <hlinkv|https://www.smashingmagazine.com/2012/06/all-about-unicode-utf8-character-sets/>.
154 A strategy for reading the multiple bytes of a UTF-8 character is here:
155 <hlinkv|https://stackoverflow.com/a/34240796/>.
158 <item*|<cpp|for()>>A generalization of <cpp|while()>. Takes three
162 <item>Local statement to run before loop (e.g. to initialize a counting
165 <item>Local statement that, if evaluated as true, permits running of
166 next iteration of loop.
168 <item>Local statement to run after loop (e.g. to increment a counting
172 <item*|<cpp|putchar(int arg1)><label|func putchar>>Write one integer
173 character (e.g. <cpp|arg1>) at a time.
175 <item*|<cpp|printf()>>Used for printing formatted text to console.
177 Character codes include:
179 <\description-aligned>
180 <item*|<cpp|%d>>Used with <cpp|int> (i.e. 16-bit integers; max value of
181 <math|2<rsup|16>=32\<space\>767>).
183 <item*|<cpp|%ld>>Used with <cpp|long> (i.e. at least 32-bit
184 integers).<\footnote>
185 K&R 2nd Ed., Sec. 1.5 \PThe conversion specification <cpp|%ld> tells
186 <cpp|printf> that the corresponding argument is a <cpp|long>
190 <item*|<cpp|%f>>Used with <cpp|float> and <cpp|double> (double
191 precision <cpp|float>).
192 </description-aligned>
204 <associate|preamble|false>
210 <associate|auto-1|<tuple|1|?>>
211 <associate|auto-2|<tuple|1.1|?>>
212 <associate|auto-3|<tuple|1.2|?>>
213 <associate|auto-4|<tuple|1.2.1|?>>
214 <associate|footnote-1|<tuple|1|?>>
215 <associate|footnote-1.1.1|<tuple|1.1.1|?>>
216 <associate|footnote-1.2.1|<tuple|1.2.1|?>>
217 <associate|footnote-1.2.2|<tuple|1.2.2|?>>
218 <associate|footnr-1.1.1|<tuple|1.1.1|?>>
219 <associate|footnr-1.2.1|<tuple|1.2.1|?>>
220 <associate|footnr-1.2.2|<tuple|1.2.2|?>>
221 <associate|func getchar|<tuple|1.2.1|?>>
222 <associate|func putchar|<tuple|3|?>>
223 <associate|ref includehelp-oct-hex|<tuple|1.1.1|?>>
224 <associate|term declaration|<tuple|1.1|?>>
225 <associate|term definition|<tuple|declaration<label|term declaration>|?>>
226 <associate|term enumeration|<tuple|definition<label|term definition>|?>>
227 <associate|term escape_sequence|<tuple|enumeration<label|term
229 <associate|term garbage_collection|<tuple|<with|mode|<quote|prog>|prog-language|<quote|cpp>|font-family|<quote|rm>|\\x><with|font-shape|<quote|italic>|hh>|?>>
230 <associate|term heap|<tuple|garbage collection|?>>
231 <associate|term machine-independent|<tuple|<label|term heap>heap|?>>
232 <associate|term operand|<tuple|<label|term
233 machine-independent>machine-independent|?>>
234 <associate|term operator|<tuple|<label|term operand>operand|?>>
235 <associate|term stack|<tuple|<label|term operator>operator|?>>
236 <associate|term struct|<tuple|<label|term stack>stack|?>>
237 <associate|term structure_assignment|<tuple|<label|term struct>struct|?>>
238 <associate|term text_stream|<tuple|structure assignment|?>>
245 <vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|1<space|2spc>Definitions>
246 <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
247 <no-break><pageref|auto-1><vspace|0.5fn>
249 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>>
250 <no-break><pageref|auto-2>
252 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>>
253 <no-break><pageref|auto-3>
255 <with|par-left|<quote|1tab>|1.2.1<space|2spc>Character Input and Output
256 <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
257 <no-break><pageref|auto-4>>