Introduction to the C Programming Language

Introduction to the C Programming Language

Snippet of a C Program

As many books do, this started out as a set of notes for a class. I taught several C classes for the staff at Rockwell Space Operations in Houston when I worked on the Space Shuttle Program. What I wanted to do was to drive home that the engineers, who up to this point had been using Fortran, actually knew many of the concepts and processes already. They weren’t starting from scratch. A good bit of what they needed to know was more along the lines of “how do I write that in C.”

The document below is the first several chapters, then a few with just the section headings, and a few of the last chapters removed. I can’t give away the entire book! I never looked into getting it published because at the time there we so many C books on the market I couldn’t see what one more would add. Also, my book was targeted to a very specific audience. Some of the later chapters cover issues and problems specific to writing scientific code, developing large-scale trajectory simulations, and other topics important to Space Shuttle engineers. A few examples:

  • How to handle passing invalid values to mathematical functions, e.g., log(-1). Space vehicle software just can’t pass back NaN (=”not a number”). How do systems that cannot afford to crash handle these situations?
  • When a complex calculation yields a value that is essentially, say, zero, it usually isn’t exactly zero. A value like 10^-10 meters is a very small distance (it’s an angstrom, actually) but it’s not zero. If you test if it’s equal to zero it will fail. When is a value “near enough” to another value?

The book was written using LaTeX. A very dear friend and I wrote a graduate textbook titled Modern Astrodynamics and that project was my first exposure to LaTeX. It works. You can solve just about any typesetting problem you want with it. It took some time to learn, but it was well worth the investment.

Introduction to the C Programming Language (pdf)