Chapter 2. Storing and Stating

The essence of programming is the manipulation of data. A programming language provides humans an interface for telling the computer what that data is and what you want to do to that data. Languages designed for powerful machines may hide (or infer) a lot of the details about storing data, but C remains fairly simple in this regard. Perhaps simple is the wrong word, but its approach to data storage is straightforward while still allowing for complex manipulation. As we’ll see in Chapter 6, C also provides the programmer with a window into the low-level aspects of where the data is stored in the computer’s memory. When we start working directly with microcontrollers in the latter half of this book, that access will become more important.

For now though, I want to tackle some of the basics of C’s syntax so that we can start composing original programs rather than just copying lines of code from a book. This chapter has plenty of those lines, and you are heartily encouraged to copy them as you read! But hopefully, we’ll get to the point where you can create novel answers to your own programming challenges.

Note

If you already feel comfortable with programming from your experience in another language, feel free to skim this chapter. You should read “printf() and scanf()” on the printf() and scanf() functions, but other sections will likely be familiar.

Statements in C

Another concept you hear about as a fundamental element of programming ...

Get Smaller C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.