0% found this document useful (0 votes)
18 views

Data Types in C+ +: Abdul Shakoor

This document discusses the main data types in C++ including integer (int), floating point (float), double precision (double), characters (char), and boolean (bool). It provides details on the storage size and value ranges for each data type, and also describes integer qualifiers like short int, long int, and unsigned int that allow changing the storage capacity of integer types.

Uploaded by

Abdul Shakoor
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Data Types in C+ +: Abdul Shakoor

This document discusses the main data types in C++ including integer (int), floating point (float), double precision (double), characters (char), and boolean (bool). It provides details on the storage size and value ranges for each data type, and also describes integer qualifiers like short int, long int, and unsigned int that allow changing the storage capacity of integer types.

Uploaded by

Abdul Shakoor
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

DATA TYPES IN C+

+
Presented By

ABDUL SHAKOOR

Data Types

1.
2.
3.
4.
5.

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:
Int
float
double
char
bool

Integer
Floating Point
Double Precision
Characters
Boolean

1. The int Data Type


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.

a.
b.
c.

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:
Short int
Long int
Unsigned int

a. The short int


The storage capacity of a short int type
variable is two bytes.
It can store integer from -32768 to
32767.

b. The long int


The storage capacity of a long int type
variable is four bytes.
It can store values from -2147483648 to
2147483647.

c.

The unsigned int

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.

2. The float Data


Type
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.

3.The double Data


Type
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.

4.The char Data


Type
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.

5. The bool Data


Type

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.

THE END

THANK YOU

You might also like