© Mikael Olsson 2019
Mikael OlssonModern C Quick Syntax Referencehttps://doi.org/10.1007/978-1-4842-4288-9_3

3. Variables

Mikael Olsson1 
(1)
Hammarland, Länsi-Suomi, Finland
 

Variables are used for storing data during program execution.

Data Types

Depending on what data you need to store, there are several different kinds of built-in data types in C. The so-called simple or primitive types are listed in the following table. They consist of four integer types, three floating-point types, as well as the char type .

Data Type

Size (Byte)

Description

char

1

Integer or character

short

int

long

long long

2

4

4 or 8

8

Integer

float

double

long double

4

8

8 or 16

Floating-point number

In C, the exact sizes of the data types are not fixed. The sizes shown in the ...

Get Modern C Quick Syntax Reference: A Pocket Guide to the Language, APIs, and Library 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.