This book teaches how computers actually work using small programs written in the C language, exploring numbers, overflow, primes, and algorithms through hands-on experimentation.
You would not know it by looking at me, but I have been computer programming as a hobby since I was 14 years old. My first programming language was QBASIC. It was a language and a program for interpreting that language that ran on MS-DOS. However, the usage of this language has diminished over time because it does not run without an emulator or modern BASIC language dialects meant to mimic it.
However, I moved to the C Programming Language as my main computer language. I have dabbled in Java, JavaScript, Lua, Perl, Python, and the beast known as C++. However, of all these languages, C remains my native language because of how simple it is to remember. In spite of its quirks, C is what I recommend to a beginner, not in spite of its limitations but because of them! Therefore, most of the recipes in this code cookbook will be in the form of C source code.
But this book will contain more than just the C language. There are times when other languages, such as Bash, HTML, Markdown, and maybe even Lua or Python, will just make a lot more sense in the context of what is being done.
For example, computer programming is used to create art, web pages, books, and video games. However, programming is also hard work and a lonely pursuit because almost nobody understands it except those of us who are called to this sacrificial art of communicating with a computer.
I got my start in the world of computer programming because I first loved numbers. I am the stereotype of an autistic savant who sees everything as a number. If you like numbers, my hope is that my recipes for generating number patterns will be of some use to you.
And if you don't like numbers, then you probably won't do well as a computer programmer because everything is a number in the context of a computer. The size, shape, and color of every text or picture element in the video games you play were, at one point, written into the code by one or more programmers who probably were not paid enough for the work that went into their craft!
This book is meant to be used as an introduction to programming for people who like arithmetic and numbers in general. No prior programming experience is necessary, but it certainly helps. I have included instructions on how to install a C compiler and get started writing small programs.
Other than that, this book can be used as a reference book for how to achieve things using a specific programming language. I frequently refer to it when I forget how I implemented an algorithm. For example, my "Powers of Two" program and my "Prime Finder" are programs that date back as far as my teenage years. These were my introduction to the joy of computer programming. Maybe they can be yours too!