In a program, we typically need data in the form of strings and numbers. Even numbers are of different kinds and size. Hence, computer scientists devised data types. There are basic data types and their variations. Let us study them in detail.

2.2.1 Simple data types

There are three basic data types in a programming language like C++. They are integer, real and character. To represent them, C++ has defined following keywords:

Integer represented by int

Real represented by float

Character represented by char

The language supports four modifiers for these basic data types, namely short, long, signed or unsigned. As the name suggests “short” indicates a small number while “long” indicates large number. The modifier “signed” signifies ...

Get Object Oriented Programming with C++, Second 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.