7 Numbers

You have used numbers to measure and display temperature, weight, and how long to cook a turkey. Now let’s take a closer look at how numbers work in C programming. On a computer, numbers come in two flavors: integers and floating-point numbers. You have already used both.

Integers

An integer is a number without a decimal point – a whole number. Integers are good for tasks like counting. Some tasks, like counting every person on the planet, require really large numbers. Other tasks, like counting the number of children in a classroom, require numbers that are not as large.

To address these different tasks, integer variables come in different sizes. An integer variable has a certain number of bits in which it can ...

Get Objective-C Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.