2.2 DATA TYPES

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 O’Reilly online learning.

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