13
DATA TYPES IN C++ Presented By ABDUL SHAKOOR

Data Types

Embed Size (px)

DESCRIPTION

Programming

Citation preview

Page 1: Data Types

DATA TYPES IN C++

Presented By

ABDUL SHAKOOR

Page 2: Data Types

The variable type specifies the type of data that can be stored in it . Each variable is declared by its types. These data types are:

1. Int Integer2. float Floating Point3. double Double Precision4. char Characters5. bool Boolean

Data Types

Page 3: Data Types

The int represents the integer data . It is used to declare integer type variables.

An integer is a whole number , i.e. a number without fraction or decimal point. For example, 764,97, -7 and 501 are integers.

An integer type variable takes two bytes in the memory.

The range of values stored is from -32768 to 32767.

1. The int Data Type

Page 4: Data Types

The storage capacity for integer type variables can be changed by applying the integer qualifiers . There are three qualifiers that can be applied to int type variables. These are:

a. Short intb. Long intc. Unsigned int

Page 5: Data Types

The storage capacity of a short int type variable is two bytes.

It can store integer from -32768 to 32767.

a. The short int

Page 6: Data Types

The storage capacity of a long int type variable is four bytes.

It can store values from -2147483648 to 2147483647.

b. The long int

Page 7: Data Types

The unsigned int can store only positive whole-numbers.

Its storage capacity is two bytes. It can store integer values from 0 to

65,535.

c. The unsigned int

Page 8: Data Types

The float represents real or floating type data.

The real data type is represented in decimal or exponential notation

Float type data may be signed or unsigned. For example, 23.26, 0.56, -9.81 are the examples of floating type data.

The storage capacity for float type variable is four bytes and it can store real values from 3.4x10^-38 to 3.4x10^+38.

2. The float Data Type

Page 9: Data Types

The double is real or floating type data. Its storage capacity is twice the capacity of float data type.

It is used to store the large real values. The storage capacity for a double type

variable is 8 bytes and it can store real values from 1.7x10^-308 to 1.7x10^+308.

3.The double Data Type

Page 10: Data Types

The char stands for character . It is used to declare character type variables.

In character type variables, alphabetic characters, numeric digits and special characters can be stored.

The storage capacity for a single character is 8 bits or one byte.

A char types variable can hold from 1 to 65,535 bytes.

4.The char Data Type

Page 11: Data Types

The word bool stands for boolean .

It is used to declare logical type variables.

In a logical type variable, only two values true or false can be stored .

The true is equivalent to 1 and false to 0.

5. The bool Data Type

Page 12: Data Types

THE END

Page 13: Data Types

THANK YOU