# Footnotes

1. https://www.ioccc.org/↩︎

2. https://en.wikipedia.org/wiki/Python_(programming_language)↩︎

3. https://en.wikipedia.org/wiki/JavaScript↩︎

4. https://en.wikipedia.org/wiki/Java_(programming_language)↩︎

5. https://en.wikipedia.org/wiki/Rust_(programming_language)↩︎

6. https://en.wikipedia.org/wiki/Go_(programming_language)↩︎

7. https://en.wikipedia.org/wiki/Swift_(programming_language)↩︎

8. https://en.wikipedia.org/wiki/Objective-C↩︎

9. https://en.wikipedia.org/wiki/ANSI_C↩︎

10. https://en.wikipedia.org/wiki/POSIX↩︎

11. https://visualstudio.microsoft.com/vs/community/↩︎

12. https://docs.microsoft.com/en-us/windows/wsl/install-win10↩︎

13. https://developer.apple.com/xcode/↩︎

14. https://beej.us/guide/bgc/↩︎

15. https://en.cppreference.com/↩︎

17. https://www.reddit.com/r/C_Programming/↩︎

18. https://en.wikipedia.org/wiki/Assembly_language↩︎

19. https://en.wikipedia.org/wiki/Bare_machine↩︎

20. https://en.wikipedia.org/wiki/Operating_system↩︎

21. https://en.wikipedia.org/wiki/Embedded_system↩︎

22. https://en.wikipedia.org/wiki/Rust_(programming_language)↩︎

23. https://en.wikipedia.org/wiki/Grok↩︎

24. I know someone will fight me on that, but it’s gotta be at least in the top three, right?↩︎

25. Well, technically there are more than two, but hey, let’s pretend there are two—ignorance is bliss, right?↩︎

26. https://en.wikipedia.org/wiki/Assembly_language↩︎

27. https://en.wikipedia.org/wiki/Machine_code↩︎

28. Technically, it contains preprocessor directives and function prototypes (more on that later) for common input and output needs.↩︎

29. https://en.wikipedia.org/wiki/Unix↩︎

30. If you don’t give it an output filename, it will export to a file called a.out by default—this filename has its roots deep in Unix history.↩︎

31. A “byte” is typically an 8-bit binary number. Think of it as an integer that can only hold the values from 0 to 255, inclusive. Technically, C allows bytes to be any number of bits and if you want to unambiguously refer to an 8-bit number, you should use the term octet. But programmers are going assume you mean 8-bits when you say “byte” unless you specify otherwise.↩︎

32. I’m seriously oversimplifying how modern memory works, here. But the mental model works, so please forgive me.↩︎

33. Read this as “pointer to a char” or “char pointer”. “Char” for character. Though I can’t find a study, it seems anecdotally most people pronounce this as “char”, a minority say “car”, and a handful say “care”. We’ll talk more about pointers later.↩︎

34. Colloquially, we say they have “random” values, but they aren’t truly—or even pseudo-truly—random numbers.↩︎

35. This isn’t strictly 100% true. When we get to learning about static storage duration, you’ll find the some variables are initialized to zero automatically. But the safe thing to do is always initialize them.↩︎

36. The _t is short for type.↩︎

37. Except for with variable length arrays—but that’s a story for another time.↩︎

38. This was considered such a hazard that the designers of the Go Programming Language made break the default; you have to explicitly use Go’s fallthrough statement if you want to fall into the next case.↩︎

39. Never say “never”.↩︎

40. Typically. I’m sure there are exceptions out there in the dark corridors of computing history.↩︎

41. A byte is a number made up of no more than 8 binary digits, or bits for short. This means in decimal digits just like grandma used to use, it can hold an unsigned number between 0 and 255, inclusive.↩︎

42. The order that bytes come in is referred to as the endianness of the number. Common ones are big endian and little endian. This usually isn’t something you need to worry about.↩︎

43. That is, base 16 with digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.↩︎

44. That’s not all! It’s used in /*comments*/ and multiplication and in function prototypes with variable length arrays! It’s all the same *, but the context gives it different meaning.↩︎

45. https://en.wikipedia.org/wiki/Null_pointer#History↩︎

46. https://en.wikipedia.org/wiki/Sentinel_value↩︎

47. The pointer type variables are a, d, f, and i, because those are the ones with * in front of them.↩︎

48. These days, anyway.↩︎

49. Again, not really, but variable-length arrays—of which I’m not really a fan—are a story for another time.↩︎

50. Since arrays are just pointers to the first element of the array under the hood, there’s no additional information recording the length.↩︎

51. Because when you pass an array to a function, you’re actually just passing a pointer to the first element of that array, not the “entire” array.↩︎

52. In the good old MS-DOS days before memory protection was a thing, I was writing some particularly abusive C code that deliberately engaged in all kinds of undefined behavior. But I knew what I was doing, and things were working pretty well. Until I made a misstep that caused a lockup and, as I found upon reboot, nuked all my BIOS settings. That was fun. (Shout-out to @man for those fun times.)↩︎

53. There are a lot of things that cause undefined behavior, not just out-of-bounds array accesses. This is what makes the C language so exciting.↩︎

54. https://en.wikipedia.org/wiki/Row-_and_column-major_order↩︎

55. This is technically incorrect, as a pointer to an array and a pointer to the first element of an array have different types. But we can burn that bridge when we get to it.↩︎

56. C11 §6.7.6.2¶1 requires it be greater than zero. But you might see code out there with arrays declared of zero length at the end of structs and GCC is particularly lenient about it unless you compile with -pedantic. This zero-length array was a hackish mechanism for making variable-length structures. Unfortunately, it’s technically undefined behavior to access such an array even though it basically worked everywhere. C99 codified a well-defined replacement for it called flexible array members, which we’ll chat about later.↩︎

57. This is also equivalent: void print_2D_array(int (*a)[3]), but that’s more than I want to get into right now.↩︎

58. Though it is true that C doesn’t track the length of strings.↩︎

59. If you’re using the basic character set or an 8-bit character set, you’re used to one character being one byte. This isn’t true in all character encodings, though.↩︎

60. This is different than the NULL pointer, and I’ll abbreviate it NUL when talking about the character versus NULL for the pointer.↩︎

61. Later we’ll learn a neater way to do it with pointer arithmetic.↩︎

62. There’s a safer function called strncpy() that you should probably use instead, but we’ll get to that later.↩︎

63. Although in C individual items in memory like ints are referred to as “objects”, they’re not objects in an object-oriented programming sense.↩︎

64. The Saturn was a popular brand of economy car in the United States until it was put out of business by the 2008 crash, sadly so to us fans.↩︎

65. A pointer is likely 8 bytes on a 64-bit system.↩︎

66. A deep copy follows pointer in the struct and copies the data they point to, as well. A shallow copy just copies the pointers, but not the things they point to. C doesn’t come with any built-in deep copy functionality.↩︎

67. https://stackoverflow.com/questions/141720/how-do-you-compare-structs-for-equality-in-c↩︎

68. We used to have three different newlines in broad effect: Carriage Return (CR, used on old Macs), Linefeed (LF, used on Unix systems), and Carriage Return/Linefeed (CRLF, used on Windows systems). Thankfully the introduction of OS X, being Unix-based, reduced this number to two.↩︎

69. If the buffer’s not big enough to read in an entire line, it’ll just stop reading mid-line, and the next call to fgets() will continue reading the rest of the line.↩︎

70. Normally the second program would read all the bytes at once, and then print them out in a loop. That would be more efficient. But we’re going for demo value, here.↩︎

71. https://en.wikipedia.org/wiki/Hex_dump↩︎

72. https://en.wikipedia.org/wiki/Endianess↩︎

73. And this is why I used individual bytes in my fwrite() and fread() examples, above, shrewdly.↩︎

74. https://en.wikipedia.org/wiki/Protocol_buffers↩︎

75. We’ll talk more about these later.↩︎

76. Recall that the sizeof operator tells you the size in bytes of an object in memory.↩︎

77. Or string, which is really an array of chars. Somewhat peculiarly, you can also have a pointer that references one past the end of the array without a problem and still do math on it. You just can’t dereference it when it’s out there.↩︎

78. Because remember that array notation is just a dereference and some pointer math, and you can’t dereference a void*!↩︎

79. You can also cast the void* to another type, but we haven’t gotten to casts yet.↩︎

80. Or until the program exits, in which case all the memory allocated by it is freed. Asterisk: some systems allow you to allocate memory that persists after a program exits, but it’s system dependent, out of scope for this guide, and you’ll certainly never do it on accident.↩︎

81. http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_460↩︎

82. https://en.wikipedia.org/wiki/Bit_bucket↩︎

83. “Bit” is short for binary digit. Binary is just another way of representing numbers. Instead of digits 0-9 like we’re used to, it’s digits 0-1.↩︎

84. https://en.wikipedia.org/wiki/Two%27s_complement↩︎

85. The industry term for a sequence of exactly, indisputably 8 bits is an octet.↩︎

86. In general, f you have an $$n$$ bit two’s complement number, the signed range is $$-2^{n-1}$$ to $$2^{n-1}-1$$. And the unsigned range is $$0$$ to $$2^n-1$$.↩︎

87. https://en.wikipedia.org/wiki/ASCII↩︎

88. https://en.wikipedia.org/wiki/List_of_information_system_character_sets↩︎

89. https://en.wikipedia.org/wiki/Unicode↩︎

90. Depends on if a char defaults to signed char or unsigned char↩︎

91. https://en.wikipedia.org/wiki/Signed_number_representations#Signed_magnitude_representation↩︎

92. My char is signed.↩︎

93. https://en.wikipedia.org/wiki/IEEE_754↩︎

94. This program runs as its comments indicate on a system with FLT_DIG of 6 that uses IEEE-754 base-2 floating point numbers. Otherwise, you might get different output.↩︎

95. It’s really surprising to me that C doesn’t have this in the spec yet. In the C99 Rationale document, they write, “A proposal to add binary constants was rejected due to lack of precedent and insufficient utility.” Which seems kind of silly in light of some of the other features they kitchen-sinked in there! I’ll bet one of the next releases has it.↩︎

96. https://en.wikipedia.org/wiki/Scientific_notation↩︎

97. They’re the same except snprintf() allows you to specify a maximum number of bytes to output, preventing the overrunning of the end of your string. So it’s safer.↩︎

98. https://en.wikipedia.org/wiki/ASCII↩︎

99. We have to pass a pointer to badchar to strtoul() or it won’t be able to modify it in any way we can see, analogous to why you have to pass a pointer to an int to a function if you want that function to be able to change that value of that int.↩︎

100. Each character has a value associated with it for any given character encoding scheme.↩︎

101. In practice, what’s probably happening on your implementation is that the high-order bits are just being dropped from the result, so a 16-bit number 0x1234 being converted to an 8-bit number ends up as 0x0034, or just 0x34.↩︎

102. Again, in practice, what will likely happen on your system is that the bit pattern for the original will be truncated and then just used to represent the signed number, two’s complement. For example, my system takes an unsigned char of 192 and converts it to signed char -64. In two’s complement, the bit pattern for both these numbers is binary 11000000.↩︎

103. Not really—it’s just discarded regularly.↩︎

104. Functions with a variable number of arguments.↩︎

105. This is rarely done because the compiler will complain and having a prototype is the Right Thing to do. I think this still works for historic reasons, before prototypes were a thing.↩︎

106. https://gustedt.wordpress.com/2010/08/17/a-common-misconsception-the-register-keyword/↩︎

107. https://en.wikipedia.org/wiki/Processor_register↩︎

108. https://en.wikipedia.org/wiki/Boids↩︎

109. Historially, MS-DOS and Windows programs would do this differently than Unix. In Unix, the shell would expand the wildcard into all matching files before your program saw it, whereas the Microsoft variants would pass the wildcard expression into the program to deal with. In any case, there are arguments that get passed into the program.↩︎

110. Since they’re just regular parameter names, you don’t actually have to call them argc and argv. But it’s so very idiomatic to use those names, if you get creative, other C programmers will look at you with a suspicious eye, indeed!↩︎

111. ps, Process Status, is a Unix command to see what processes are running at the moment.↩︎

112. https://en.wikipedia.org/wiki/Inception↩︎

113. https://en.wikipedia.org/wiki/Shell_(computing)↩︎

114. In Windows cmd.exe, type echo %errorlevel%. In PowerShell, type $LastExitCode.↩︎ 115. If you need a numeric value, convert the string with something like atoi() or strtol().↩︎ 116. In Windows CMD.EXE, use set FROTZ=value. In PowerShell, use $Env:FROTZ=value.↩︎

117. https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html↩︎

118. You can’t always just wrap the code in /* */ comments because those won’t nest.↩︎

119. This isn’t really a macro—it’s technically an identifier. But it’s the only predefined identifier and it feels very macro-like, so I’m including it here. Like a rebel.↩︎

120. A hosted implementation basically means you’re running the full C standard, probably on an operating system of some kind. Which you probably are. If you’re running on bare metal in some kind of embedded system, you’re probably on a standalone implementation.↩︎

121. OK, I know that was a cop-out answer. Basically there’s an optional extension compilers can implement wherein they agree to limit certain types of undefined behavior so that the C code is more amenable to static code analysis. It is unlikely you’ll need to use this.↩︎

122. Breakin’ the law… breakin’ the law…↩︎

123. https://www.openmp.org/↩︎

124. Technically we say that it has an incomplete type.↩︎

125. Though some compilers have options to force this to occur—search for __attribute__((packed)) to see how to do this with GCC.↩︎

126. Assuming 8-bit chars, i.e. CHAR_BIT == 8.↩︎

127. https://en.wikipedia.org/wiki/Type_punning↩︎

128. I just made up that number, but it’s probably not far off↩︎

129. There’s some devil in the details with values that are stored in registers only, but we can safely ignore that for our purposes here. Also the C spec makes no stance on these “register” things beyond the register keyword, the description for which doesn’t mention registers.↩︎

130. You’re very likely to get different numbers on yours.↩︎

131. There is absolutely nothing in the spec that says this will always work this way, but it happens to work this way on my system.↩︎

132. Even if E is NULL, it turns out, weirdly.↩︎

133. Your C compiler is not required to add padding bytes, and the values of any padding bytes that are added are indeterminate.↩︎

134. This will vary depending on the architecture, but my system is little endian, which means the least-significant byte of the number is stored first. Big endian systems will have the 12 first and the 78 last. But the spec doesn’t dictate anything about this representation.↩︎

135. It’s an optional feature, so it might not be there—but it probably is.↩︎

136. I’m printing out the 16-bit values reversed since I’m on a little-endian machine at it makes it easier to read here.↩︎

137. Assuming they point to the same array object.↩︎

138. The Go Programming Language drew its type declaration syntax inspiration from the opposite of what C does.↩︎

139. Not that other languages don’t do this—they do. It is interesting how many modern languages use the same operators for bitwise that C does.↩︎

140. https://en.wikipedia.org/wiki/Bitwise_operation↩︎

141. That is, us lowly developers aren’t supposed to know what’s in there or what it means. The spec doesn’t dictate what it is in detail.↩︎

142. Honestly, it would be possible to remove that limitation from the language, but the idea is that the macros va_start(), va_arg(), and va_end() should be able to be written in C. And to make that happen, we need some way to initialize a pointer to the location of the first parameter. And to do that, we need the name of the first parameter. It would require a language extension to make this possible, and so far the committee hasn’t found a rationale for doing so.↩︎

143. “This planet has—or rather had—a problem, which was this: most of the people living on it were unhappy for pretty much of the time. Many solutions were suggested for this problem, but most of these were largely concerned with the movement of small green pieces of paper, which was odd because on the whole it wasn’t the small green pieces of paper that were unhappy.” —The Hitchhiker’s Guide to the Galaxy, Douglas Adams↩︎

144. Remember that char is just a byte-sized integer.↩︎

145. Except for isdigit() and isxdigit().↩︎

146. For example, we could store the code point in a big-endian 32-bit integer. Straightforward! We just invented an encoding! Actually not; that’s what UTF-32BE encoding is. Oh well—back to the grind!↩︎

147. Ish. Technically, it’s variable width—there’s a way to represent code points higher than $$2^{16}$$ by putting two UTF-16 characters together.↩︎

148. There’s a special character called the Byte Order Mark (BOM), code point 0xFEFF, that can optionally precede the data stream and indicate the endianess. It is not required, however.↩︎

149. Again, this is only true in UTF-16 for characters that fit in two bytes.↩︎

150. https://en.wikipedia.org/wiki/UTF-8↩︎

152. Presumably the compiler makes the best effort to translate the code point to whatever the output encoding is, but I can’t find any guarantees in the spec.↩︎

153. With a format specifier like "%s.12", for example.↩︎

154. wcscoll() is the same as wcsxfrm() followed by wcscmp().↩︎

155. Ish—things get funky with multi-char16_t UTF-16 encodings.↩︎

156. https://en.wikipedia.org/wiki/Iconv↩︎

157. http://site.icu-project.org/↩︎

158. https://en.wikipedia.org/wiki/Core_dump↩︎

159. Apparently it doesn’t do Unix-style signals at all deep down, and they’re simulated for console apps.↩︎

160. Confusingly, sig_atomic_t predates the lock-free atomics and is not the same thing.↩︎

161. If sig_action_t is signed, the range will be at least -127 to 127. If unsigned, at least 0 to 255.↩︎

162. This is due to how VLAs are typically allocated on the stack, whereas static variables are on the heap. And the whole idea with VLAs is they’ll be automatically dellocated when the stack frame is popped at the end of the function.↩︎

163. https://en.wikipedia.org/wiki/Goto#Criticism↩︎

164. I’d like to point out that using goto in all these cases is avoidable. You can use variables and loops intead. It’s just that some people think goto produces the best code in those circumstances.↩︎

165. https://en.wikipedia.org/wiki/Tail_call↩︎

166. Which isn’t quite the same, since it’s an array, not a pointer to an int.↩︎

167. A variable used here is an expression.↩︎

168. Both “stack pointer” and “program counter” are related to the underlying architecture and C implementation, and are not part of the spec.↩︎

169. The rationale here is that the program might store a value temporarily in a CPU register while it’s doing work on it. In that timeframe, the register holds the correct value, and the value on the stack might be out of date. Then later the register values would get overwritten and the changes to the variable lost.↩︎

170. That is, remain allocated until the program ends with no way to free it.↩︎

171. This works because in C, pointers are the same size regardless of the type of data they point to. So the compiler doesn’t need to know the size of the struct node at this point; it just needs to know the size of a pointer.↩︎

172. https://en.wikipedia.org/wiki/Complex_number↩︎

173. This was a harder one to research, and I’ll take any more information anyone can give me. I could be defined as _Complex_I or _Imaginary_I, if the latter exists. _Imaginary_I will handle signed zeros, but _Complex_I might not. This has implications with branch cuts and other complex-numbery-mathy things. Maybe. Can you tell I’m really getting out of my element here? In any case, the CMPLX() macros behave as if I were defined as _Imaginary_I, with signed zeros, even if _Imaginary_I doesn’t exist on the system.↩︎

174. The simplicity of this statement doesn’t do justice to the incredible amount of work that goes into simply understanding how floating point actually functions. https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/↩︎

175. This is the only one that doesn’t begin with an extra leading c, strangely.↩︎

176. Some architectures have different sized data that the CPU and RAM can operate with at a faster rate than others. In those cases, if you need the fastest 8-bit number, it might give you have a 16- or 32-bit type instead because that’s just faster. So with this, you won’t know how big the type is, but it will be least as big as you say.↩︎

177. Namely, the system has 8, 16, 32, or 64 bit integers with no padding that use two’s complement representation, in which case the intN_t variant for that particular number of bits must be defined.↩︎

178. On Earth, anyway. Who know what crazy systems they use out there↩︎

179. OK, don’t murder me! GMT is technically a time zone while UTC is a global time system. Also some countries might adjust GMT for daylight saving time, whereas UTC is never adjusted for daylight saving time.↩︎

180. Admittedly, there are more than two.↩︎

181. https://en.wikipedia.org/wiki/Unix_time↩︎

182. You will on POSIX, where time_t is definitely an integer. Unfortunately the entire world isn’t POSIX, so there we are.↩︎

184. I’m more a fan of shared-nothing, myself, and my skills with classic multithreading constructs are rusty, to say the least.↩︎

185. Yes, pthreads with a “p”. It’s short for POSIX threads, a library that C11 borrowed liberally from for its threads implementation.↩︎

186. Per §7.1.4¶5.↩︎

187. Unless you thrd_detach(). More on this later.↩︎

188. Though I don’t think they have to be. It’s just that the threads don’t seem to get rescheduled until some system call like might happen with a printf()… which is why I have the printf() in there.↩︎

189. Short for “mutual exclusion”, AKA a “lock” on a section of code that only one thread is permitted to execute.↩︎

190. That is, your process will go to sleep.↩︎

191. You might have expected it to be “time from now”, but you’d just like to think that, wouldn’t you!↩︎

192. And that’s why they’re called condition variables!↩︎

193. I’m not saying it’s aliens… but it’s aliens. OK, really more likely another thread might have been woken up and gotten to the work first.↩︎

194. Survival of the fittest! Right? I admit it’s actually nothing like that.↩︎

195. The __STDC_VERSION__ macro didn’t exist in early C89, so if you’re worried about that, check it with #ifdef.↩︎

196. The reason for this is when optimized, my compiler has put the value of x in a register to make the while loop fast. But the register has no way of knowing that the variable was updated in another thread, so it never sees the 3490. This isn’t really related to the all-or-nothing part of atomicity, but is more related to the synchronization aspects in the next section.↩︎

197. Until I say otherwise, I’m speaking generally about sequentially consistent operations. More on what that means soon.↩︎

198. Sanest from a programmer perspective.↩︎

199. Apparently C++23 is adding this as a macro.↩︎

200. The spec notes that they might differ in size, representation, and alignment.↩︎

201. I just pulled that example out of nowhere. Maybe it doesn’t matter on Intel/AMD, but it could matter somewhere, dangit!↩︎

202. C++ elaborates that if the signal is the result of a call to raise(), it is sequenced after the raise().↩︎

203. https://en.wikipedia.org/wiki/Test-and-set↩︎

204. Because consume is all about the operations that are dependent on the value of the acquired atomic variable, and there is no atomic variable with a fence.↩︎

205. https://channel9.msdn.com/Shows/Going+Deep/Cpp-and-Beyond-2012-Herb-Sutter-atomic-Weapons-1-of-2↩︎

206. https://channel9.msdn.com/Shows/Going+Deep/Cpp-and-Beyond-2012-Herb-Sutter-atomic-Weapons-2-of-2↩︎

207. https://preshing.com/archives/↩︎

208. https://preshing.com/20120612/an-introduction-to-lock-free-programming/↩︎

209. https://preshing.com/20120913/acquire-and-release-semantics/↩︎

210. https://preshing.com/20130702/the-happens-before-relation/↩︎

211. https://preshing.com/20130823/the-synchronizes-with-relation/↩︎

212. https://preshing.com/20140709/the-purpose-of-memory_order_consume-in-cpp11/↩︎

214. https://en.cppreference.com/w/c/atomic/memory_order↩︎

215. https://en.cppreference.com/w/c/language/atomic↩︎

216. https://docs.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming↩︎

217. https://www.reddit.com/r/C_Programming/↩︎

218. You can do this with -O on the command line.↩︎

219. https://en.wikipedia.org/wiki/Data_structure_alignment↩︎

220. https://en.wikipedia.org/wiki/Complex_conjugate↩︎

221. https://en.wikipedia.org/wiki/Riemann_sphere↩︎

222. Really it’s just required to be a modifiable lvalue, so not necessarily a variable. But you can treat it as such.↩︎

223. https://man.archlinux.org/man/errno.3.en↩︎

224. https://docs.microsoft.com/en-us/cpp/c-runtime-library/errno-constants?view=msvc-160↩︎

225. https://en.wikipedia.org/wiki/Subnormal_number↩︎

226. The minimum value of an unsigned char is 0. Same fo an unsigned short and unsigned long. Or any unsigned type, for that matter.↩︎

227. https://en.wikipedia.org/wiki/Two%27s_complement↩︎

228. Remember that char is just a byte-sized integer.↩︎

229. Though the system defines MATH_ERRNO as 1 and MATH_ERREXCEPT as 2, it’s best to always use their symbolic names. Just in case.↩︎

230. https://en.wikipedia.org/wiki/Denormal_number↩︎

231. This is on my system. Some systems will have different points at which numbers become subnormal, or they might not support subnormal values at all.↩︎

232. https://en.wikipedia.org/wiki/E_(mathematical_constant)↩︎

233. https://en.wikipedia.org/wiki/Denormal_number↩︎

234. https://en.wikipedia.org/wiki/Pythagorean_theorem↩︎

235. https://en.wikipedia.org/wiki/Error_function↩︎

236. https://en.wikipedia.org/wiki/Error_function↩︎

237. https://en.wikipedia.org/wiki/Gamma_function↩︎

238. https://en.wikipedia.org/wiki/Gamma_function↩︎

239. https://en.cppreference.com/w/c/numeric/math/remquo↩︎

240. https://en.cppreference.com/w/c/numeric/math/remquo↩︎

241. A quiet NaN is one that doesn’t raise any exceptions.↩︎

242. https://man.archlinux.org/man/sigaction.2.en↩︎

243. As if might be sent from Unix’s kill command.]↩︎

244. https://en.wikipedia.org/wiki/Data_structure_alignment↩︎

245. Maybe it depends on the run-time environment and can’t be known at compile-time.↩︎

246. https://en.cppreference.com/w/cpp/atomic/ATOMIC_VAR_INIT↩︎

247. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1138r0.pdf↩︎

248. This effectively does the same thing, but it’s clearly not atomic.↩︎

249. The spec says, “This spurious failure enables implementation of compare-and-exchange on a broader class of machines, e.g. load-locked store-conditional machines.” And adds, “When a compare-and-exchange is in a loop, the weak version will yield better performance on some platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the strong one is preferable.”↩︎

250. Don’t use this unless you know what you’re doing—use the thread mutex functionality instead. It’ll let your blocked thread sleep and stop chewing up CPU.↩︎

251. Don’t use this unless you know what you’re doing—use the thread mutex functionality instead. It’ll let your blocked thread sleep and stop chewing up CPU.↩︎

252. https://en.wikipedia.org/wiki/Data_structure_alignment↩︎

254. https://man.archlinux.org/man/mkstemp.3.en↩︎

256. https://stackoverflow.com/questions/17017331/c99-vscanf-for-dummies/17018046#17018046↩︎

257. http://man.cat-v.org/unix-1st/3/atof↩︎

258. http://man.cat-v.org/unix-1st/3/atoi↩︎

260. https://stackoverflow.com/questions/10984974/why-do-people-say-there-is-modulo-bias-when-using-a-random-number-generator↩︎

261. https://mumble.net/~campbell/2014/04/28/uniform-random-float↩︎

262. https://www.gnu.org/software/gsl/doc/html/rng.html↩︎

263. Minecraft enthusiasts might recall that when generating a new world, they were given the option to enter a random number seed. That single value is used to generate that entire random world. And if your friend starts a world with the same seed you did, they’ll get the same world you did.↩︎

264. https://en.wikipedia.org/wiki/Unix_time↩︎

265. The C spec doesn’t say exactly what time(NULL) will return, but the POSIX spec does! And virtually everyone returns exactly that: the number of seconds since epoch.↩︎

266. https://en.wikipedia.org/wiki/Data_structure_alignment↩︎

267. “Try to imagine all life as you know it stopping instantaneously and every molecule in your body exploding at the speed of light.” —Egon Spengler↩︎

268. https://en.wikipedia.org/wiki/Core_dump↩︎

269. quick_exit() differs from exit() in that open files might not be flushed and temporary files might not be removed.↩︎

270. “In-place” meaning that the original array will hold the results; no new array is allocated.↩︎

271. It always returns the number of bytes the transformed string took, but in this case because s1 was NULL, it doesn’t actually write a transformed string.↩︎

272. Which you should because of spurious wakeups.↩︎

273. Well, as at least as many things as you have free cores. Your OS will schedule them as it can.↩︎

274. For example, if a destructor caused more variables to be set.↩︎

275. Unix-like systems have a sleep() syscall that sleeps for an integer number of seconds. But thrd_sleep() is likely more portable and gives subsecond resolution, besides!↩︎

276. When you say GMT, unless you’re talking specifically about the time zone and not the time, you probably mean “UTC”.↩︎

277. The spec doesn’t actually say “clock ticks”, but I… am.↩︎

278. Unless you’re on a POSIX system where time_t is definitely an integer, in which case you can subtract. But you should still use difftime() for maximum portability.↩︎

279. https://man.archlinux.org/man/timegm.3.en↩︎

280. https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/mkgmtime-mkgmtime32-mkgmtime64?view=msvc-160↩︎

281. https://en.wikipedia.org/wiki/Unix_time↩︎

282. https://en.wikipedia.org/wiki/ISO_week_date↩︎

283. https://en.wikipedia.org/wiki/Symbols_for_Legacy_Computing↩︎

284. https://stackoverflow.com/questions/17017331/c99-vscanf-for-dummies/17018046#17018046↩︎

285. This is a variable, not a macro, so if you use it to define an array, it’ll be a variable-length array.↩︎

286. In my non-scientific estimation. But for realsies, do the work before looking at the answer. It’s the best way to learn.↩︎

287. https://beej.us/guide/bgc/source/exercises/intro/hello_name.c↩︎

288. https://beej.us/guide/bgc/source/exercises/intro/hello_fruit.c↩︎

289. https://beej.us/guide/bgc/source/exercises/varstat/pi_approx.c↩︎

290. https://beej.us/guide/bgc/source/exercises/varstat/formula1.c↩︎

291. https://beej.us/guide/bgc/source/exercises/varstat/formula2.c↩︎

292. https://beej.us/guide/bgc/source/exercises/varstat/postinc.c↩︎

293. https://beej.us/guide/bgc/source/exercises/varstat/predec.c↩︎

294. https://beej.us/guide/bgc/source/exercises/varstat/foo17.c↩︎

295. https://beej.us/guide/bgc/source/exercises/varstat/foo17b.c↩︎

296. https://beej.us/guide/bgc/source/exercises/varstat/whilediv7.c↩︎

297. https://beej.us/guide/bgc/source/exercises/varstat/twofor.c↩︎

298. https://beej.us/guide/bgc/source/exercises/functions/funcxy.c↩︎

299. https://beej.us/guide/bgc/source/exercises/functions/pi.c↩︎

300. https://beej.us/guide/bgc/source/exercises/pointers/pointers.c↩︎

301. https://beej.us/guide/bgc/source/exercises/pointers/swap.c↩︎

302. https://beej.us/guide/bgc/source/exercises/arrays/sum.c↩︎

303. https://beej.us/guide/bgc/source/exercises/arrays/init312.c↩︎

304. https://en.wikipedia.org/wiki/Tic-tac-toe↩︎

305. https://beej.us/guide/bgc/source/exercises/arrays/tictactoe.c↩︎

306. https://beej.us/guide/bgc/source/exercises/strings/reverse.c↩︎

307. https://beej.us/guide/bgc/source/exercises/strings/str_isupper.c↩︎

308. https://beej.us/guide/bgc/source/exercises/strings/my_strchr.c↩︎

309. https://beej.us/guide/bgc/source/exercises/structs/point.c↩︎

310. https://beej.us/guide/bgc/source/exercises/structs/point_ptr.c↩︎

311. https://beej.us/guide/bgc/source/exercises/io/reverselines.c↩︎

312. https://beej.us/guide/bgc/source/exercises/io/input.txt↩︎

313. https://beej.us/guide/bgc/source/exercises/io/point_avg.c↩︎

314. https://beej.us/guide/bgc/source/exercises/typedef/vector3d.c↩︎

315. https://beej.us/guide/bgc/source/exercises/pointers2/my_strchr.c↩︎

316. https://beej.us/guide/bgc/source/exercises/pointers2/my_strrchr.c↩︎

317. https://beej.us/guide/bgc/source/exercises/pointers2/object_sum.c↩︎

318. https://beej.us/guide/bgc/source/exercises/pointers2/int_qsort.c↩︎

319. https://beej.us/guide/bgc/source/exercises/manmem/tenints.c↩︎

321. Total is now with values 1, 3, 5. total is at file scope so each call to add() affects it.↩︎

322. 5–the first increase in i is on a variable that hides the one at outer scope.↩︎

323. Prints Hi there six times. The inner declaration of i hides the outer one.↩︎

324. Assuming your machine has 8-bit bytes.↩︎

325. Wraps around like an odometer from 255 to 0. This happens because 255 is binary 11111111—all 8 bits are 1, so adding one more gets us to 100000000. But that’s 9 bits, too big to fit in your byte. The highest bit is thrown out, leaving us with binary 00000000. All unsigned types will do this when they are incremented from their highest value.↩︎

326. https://beej.us/guide/bgc/source/exercises/types2/overflow.c↩︎

327. https://beej.us/guide/bgc/source/exercises/types3/cutfrac.c↩︎

328. https://beej.us/guide/bgc/source/exercises/types3/my_atoi.c↩︎

329. https://beej.us/guide/bgc/source/exercises/types4/runner.c↩︎

330. https://beej.us/guide/bgc/source/exercises/types4/total.c↩︎

331. https://beej.us/guide/bgc/source/exercises/multifile/runner.c↩︎

332. https://beej.us/guide/bgc/source/exercises/multifile/total.c↩︎

333. https://beej.us/guide/bgc/source/exercises/multifile/total.h↩︎

334. https://beej.us/guide/bgc/source/exercises/env/printenv.c↩︎

335. https://beej.us/guide/bgc/source/exercises/cpp/macro2.c↩︎

336. https://beej.us/guide/bgc/source/exercises/cpp/cversion.c↩︎

337. https://beej.us/guide/bgc/source/exercises/cpp/condcomp.c↩︎