DATA TYPES IN C++
DATA TYPES IN C++
BY:
 M.PAVAN
 ABDULLAH
 V.VENKAT RAMANA
 G.V.MANISH REDDY
CONTENTS
 DATA TYPE
 BUILT IN TYPE
 USER DEFINED TYPE
 DERIVED TYPE
DATA TYPE
A data type is a classification that specifies the
type of value a variable can hold.
General syntax of declaration of data type is
data_type variable_name;
Example: int a;
DATA TYPE
C++ DATA TYPES
USER-DEFINED TYPE BUILT-IN TYPE DERIVED TYPE
INTEGRAL TYPE VOID FLOATING TYPE
STRUCTURE
UNION
CLASS
ENUMERATION
ARRAY
FUNCTION
POINTER
int char float double
BUILT IN DATA TYPE
C++ DATA TYPES
BUILT-IN TYPE
INTEGRAL TYPE VOID FLOATING TYPE
int char float double
BUILT IN DATA TYPE
INTEGRAL DATA TYPE
INTEGER DATA TYPE:
Keyword: int
Storage space: two bytes
Range of int: -32768 to 32767
LONG INT
INT
SHORT INT
SOME OF THE TYPES OF
INT
BUILT IN DATA TYPE
INTEGRAL DATA TYPE
CHARACTER DATA TYPE:
Keyword: char
Storage space: 1 byte
Range of char: -128 to 127
BUILT IN DATA TYPE
FLOATING DATA TYPE
FLOAT DATA TYPE:
Keyword: float
Storage space: 4 bytes
Range of float: 3.4e-38 to 3.4e+38.
BUILT IN DATA TYPE
FLOATING DATA TYPE
DOUBLE DATA TYPE:
Keyword: double
Storage space: 8 bytes
Range of double: 1.7e-308 to 1.7e+308.
LONG DOUBLE
DOUBLE
FLOAT
FLOATING TYPES
BUILT IN DATA TYPE
VOID DATA TYPE
Type void was introduced in ansi c.
Two normal use of void:
 To specify the return type of a function when
it is not returning any value.
 To indicate an empty argument list to a
function.
 Eg:- void function-name ( void )
USER DEFINED TYPE
C++ DATA TYPES
USER-DEFINED TYPE
STRUCTURE
UNION
CLASS
ENUMERATION
USER DEFINED TYPE
STRUCTURES:
Structures are used for grouping together
elements with dissimilar types.
The general syntax of a structure:-
Struct name
{
Data_type member1;
. . . . .
};
USER DEFINED TYPE
Unions:
Unions are conceptually similar to structures
as they allow us to group together dissimilar
type elements inside a single unit.
The size of union is equal to the size of its
largest member element.
USER DEFINED TYPE
CLASSES:
The entire set of data and code of an object
can be made a user-defined data type with the
help of a classes
Once a class has been defined, we can create
any number of objects belonging to that class.
Example: fruit mango;
Will create an object mango belonging to the
class fruit.
USER DEFINED TYPE
ENUMERATED DATA TYPE:
An enumerated data type is another user
defined data type which provides a way for
attaching numbers to names.
General syntax of enumerated data type is:-
enum identifier
{
Value1,valu2,………….,Valuen
};
DERIVED TYPE
C++ DATA TYPES
DERIVED TYPE
ARRAY
FUNCTION
POINTER
DERIVED TYPE
ARRAYS:
An array is a fixed sequence collection of
elements of same data type that share a
common name.
General syntax to declare is
data_type name[size];
General syntax to initialize is
for(i=0;i<=10;i++)
cin>>a[i];
DERIVED TYPE
FUNCTIONS:
 A function is a group of statements that together
perform a task.
Every c++ program has at least one function,
which is main().
void main()
{
Statements;
}
DERIVED TYPE
POINTERS:
A pointer is a variable that holds a memory
address.
General syntax to declare pointer is:-
Data_type *pointer_name;
Example:
int *p;
SUMMARY
 Structures are used for grouping together
elements with dissimilar types.
 Unions are conceptually similar to structures as
they allow us to group together dissimilar type
elements inside a single unit.
 Once a class has been defined, we can create
any number of objects belonging to that class.
 An enumerated data type is another user
defined data type which provides a way for
attaching numbers to names.
SUMMARY
 An array is a fixed sequence collection of
elements of same data type that share a
common name.
 A function is a group of statements that
together perform a task.
 A pointer is a variable that holds a memory
address.
THANK YOU

Data types in c++

  • 1.
  • 2.
    DATA TYPES INC++ BY:  M.PAVAN  ABDULLAH  V.VENKAT RAMANA  G.V.MANISH REDDY
  • 3.
    CONTENTS  DATA TYPE BUILT IN TYPE  USER DEFINED TYPE  DERIVED TYPE
  • 4.
    DATA TYPE A datatype is a classification that specifies the type of value a variable can hold. General syntax of declaration of data type is data_type variable_name; Example: int a;
  • 5.
    DATA TYPE C++ DATATYPES USER-DEFINED TYPE BUILT-IN TYPE DERIVED TYPE INTEGRAL TYPE VOID FLOATING TYPE STRUCTURE UNION CLASS ENUMERATION ARRAY FUNCTION POINTER int char float double
  • 6.
    BUILT IN DATATYPE C++ DATA TYPES BUILT-IN TYPE INTEGRAL TYPE VOID FLOATING TYPE int char float double
  • 7.
    BUILT IN DATATYPE INTEGRAL DATA TYPE INTEGER DATA TYPE: Keyword: int Storage space: two bytes Range of int: -32768 to 32767 LONG INT INT SHORT INT SOME OF THE TYPES OF INT
  • 8.
    BUILT IN DATATYPE INTEGRAL DATA TYPE CHARACTER DATA TYPE: Keyword: char Storage space: 1 byte Range of char: -128 to 127
  • 9.
    BUILT IN DATATYPE FLOATING DATA TYPE FLOAT DATA TYPE: Keyword: float Storage space: 4 bytes Range of float: 3.4e-38 to 3.4e+38.
  • 10.
    BUILT IN DATATYPE FLOATING DATA TYPE DOUBLE DATA TYPE: Keyword: double Storage space: 8 bytes Range of double: 1.7e-308 to 1.7e+308. LONG DOUBLE DOUBLE FLOAT FLOATING TYPES
  • 11.
    BUILT IN DATATYPE VOID DATA TYPE Type void was introduced in ansi c. Two normal use of void:  To specify the return type of a function when it is not returning any value.  To indicate an empty argument list to a function.  Eg:- void function-name ( void )
  • 12.
    USER DEFINED TYPE C++DATA TYPES USER-DEFINED TYPE STRUCTURE UNION CLASS ENUMERATION
  • 13.
    USER DEFINED TYPE STRUCTURES: Structuresare used for grouping together elements with dissimilar types. The general syntax of a structure:- Struct name { Data_type member1; . . . . . };
  • 14.
    USER DEFINED TYPE Unions: Unionsare conceptually similar to structures as they allow us to group together dissimilar type elements inside a single unit. The size of union is equal to the size of its largest member element.
  • 15.
    USER DEFINED TYPE CLASSES: Theentire set of data and code of an object can be made a user-defined data type with the help of a classes Once a class has been defined, we can create any number of objects belonging to that class. Example: fruit mango; Will create an object mango belonging to the class fruit.
  • 16.
    USER DEFINED TYPE ENUMERATEDDATA TYPE: An enumerated data type is another user defined data type which provides a way for attaching numbers to names. General syntax of enumerated data type is:- enum identifier { Value1,valu2,………….,Valuen };
  • 17.
    DERIVED TYPE C++ DATATYPES DERIVED TYPE ARRAY FUNCTION POINTER
  • 18.
    DERIVED TYPE ARRAYS: An arrayis a fixed sequence collection of elements of same data type that share a common name. General syntax to declare is data_type name[size]; General syntax to initialize is for(i=0;i<=10;i++) cin>>a[i];
  • 19.
    DERIVED TYPE FUNCTIONS:  Afunction is a group of statements that together perform a task. Every c++ program has at least one function, which is main(). void main() { Statements; }
  • 20.
    DERIVED TYPE POINTERS: A pointeris a variable that holds a memory address. General syntax to declare pointer is:- Data_type *pointer_name; Example: int *p;
  • 21.
    SUMMARY  Structures areused for grouping together elements with dissimilar types.  Unions are conceptually similar to structures as they allow us to group together dissimilar type elements inside a single unit.  Once a class has been defined, we can create any number of objects belonging to that class.  An enumerated data type is another user defined data type which provides a way for attaching numbers to names.
  • 22.
    SUMMARY  An arrayis a fixed sequence collection of elements of same data type that share a common name.  A function is a group of statements that together perform a task.  A pointer is a variable that holds a memory address.
  • 23.