Section III—Basic Types and Storage Classes

Summary: The Basic Data Types

C's basic types fall into two categories: integers and floating-point numbers. The different varieties give you choices for range and precision.


The basic data types are set up using the following eight keywords: int, long, short, unsigned, char, float, double, and signed (ANSI C).

Signed Integers

Signed integers can have positive or negative values.

int is the basic integer type for a given system.
long or long int can hold an integer at least as large as the largest int and possibly larger; long is at least 32 bits.
The largest short or short int integer is no larger than the largest int, and may be smaller. A short is at least 16 bits. Typically, long is bigger ...

Get C Primer Plus, Fourth Edition 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.