Chapter 2

Data Types, Variables, and Data Output

In order to be able to write programs that actually perform useful tasks that save us time and work, this chapter will teach you how to use data types and variables. We’ll also go into more detail on the most important function for outputting data: the printf() function.

Variables

The computer’s RAM (random access memory) consists of millions of successive storage cells. The size of each cell is one byte. For example, an old PC with 16 MB (megabytes) of RAM consists of 16 × 1024 kB (kilobytes), or 16.777.216 memory cells. A newer PC with say 8 GB (gigabytes) of RAM would have 8 × 1024 MB = 8192 × 1024 kB = 8.388.608 × 1.024 = 8.589.934.592 memory cells.

A variable in C is a storage location ...

Get 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.