Preface

Ask almost any computer hardware or software engineer which programming language she learned first, and the answer is bound to be C or C++. Many computer scientists start with Java or C’s stepchild, C#, but engineers normally learn C. It’s the best way, after all, to get into the basics of algorithms and operating systems. The Windows, Mac, and Linux kernels, after all, are all written mostly in C. Aside from assembly, it’s probably one of the most basic programming languages.

C is powerful, fast, and unsexy. It’s got built-in errors you may have never heard of (“What the hell is a segmentation fault?!”) and lets you mess with actual memory heaps and registers. There are no classes or even strings—you’re dealing with character arrays here, folks. There’s no fancy garbage collection; if you use some memory for an array, you’ll probably want to free up that memory when you’re done, or you’ll have a memory leak that could crash your program later.

C is cross-platform, but not in the same way that Python is cross-platform. Python code written on a Linux box can, with a few exceptions, run on a Windows machine without alterations. Most C written on a Linux computer will run on a Windows computer, but it will need to be recompiled first. C executables are specific to the machine on which they’re compiled, and transferring between operating systems can pose some unique challenges.

If you take the time to learn C (and its big brother, C++), your programming will benefit, even if you’re already an experienced Python, Java, or even web programmer. Programming in C brings you back to basics, doesn’t let you cut corners, and truly makes you think about what you’re trying to do and the best way to do it. Yes, it can be incredibly frustrating—I have lost literally hours trying to debug a piece of code, only to find it was merely missing one semicolon—but it can also be quite rewarding. There’s something about programming “close to the metal” that reminds me why I became a computer engineer in the first place.

I’m assuming that you, the reader, bring the following to this book:

  • A computer, and the ability to access the Internet
  • Some knowledge of programming, even very basic
  • A Raspberry Pi Zero or Zero W and all assorted cables
  • Some LEDs, resistors, a breadboard, and some jumper wires

So if you’re wanting to expand your horizons, and learn some new languages and some new skills, follow along and I’ll teach you some C!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.118.229