SlideShare a Scribd company logo
1 of 30
CONCEPT OF  C++ DATA TYPES MADE BY:- Yansi Keim XI-A
DATA TYPES Data types are means to identify the type of data and associated operations of handling it. C++ provides a predefined set of data types for handling the data it uses. When variables are declared of a particular data type then the variable becomes the place where the data is stored and data types is the type of value(data) stored by that variable. Data can be of may types such as character, integer, real etc. since the data to be dealt with are of may types, a programming language must provide different data types.
FUNDAMENTAL DATA TYPES DATA TYPE MODIFIERS DATA TYPES DERIVED DATA TYPES USER  DEFINED DATA TYPES
INTEGER CHARACTER FUNDAMENTAL DATA TYPES FLOAT FUNDAMENTAL DATA TYPES ARE THOSE THAT ARE NOT COMPOSED OF OTHER DATA TYPES DOUBLE VOID
INTEGER DATA TYPE Integers are whole numbers with a machine dependent range of values. A good programming language as to support the programmer by giving a control on a range of numbers and storage space. C has 3 classes of integer storage namely short int, int and long int. All of these data types have signed and unsigned forms. A short int requires half the space than normal integer values. Unsigned numbers are always positive and consume all the bits for the magnitude of the number. The long and unsigned integers are used to declare a longer range of values.
CHARACTER DATA TYPE It can store any member of the C++ implementation's basic character set. If a character from this set is stored in a character variable, its value is equivalent to the integer code of that character. Character data type is often called as integer data type because the memory implementation of char data type is in terms of the number code.
FLOAT DATA TYPE A number having fractional part is a floating- point number. An identifier declared as float becomes a floating-point variable and can hold floating-point numbers. floating point variables represent real numbers. They have two advantages over integer data types:- 1: they can represent values between integers. 2: they can represent a much greater range of values. they have one disadvantage also, that is their operations are usually slower.
The data type double is also used for handling floating-point numbers. But it is treated as a distinct data type because, it occupies twice as much memory as type float, and stores floating-point numbers with much larger range and precision. It is slower that type float. DOUBLE DATA TYPE
VOID DATA TYPE It specifies an empty set of values. It is used as the return type for functions that do not return a value. No object of type void may be declared. It is used when program or calculation does not require any value but the syntax needs it.
INTEGER TYPE MODIFIERS DATA TYPE MODIFIERS CHARACTER TYPEMODIFIERS THEY CHANGE SOME PROPERTIES OF THE DATA TYPE FLOATING-POINT MODIFIERS
INTEGER TYPE MODIFIERS C++ offers three types of integer data type:- 1:-  short integer- at least two bytes. 2:-  int integer – at least as big as short. 3:- long integer-at least four bytes.   the prefix signed makes the integer type hold negative values also. Unsigned makes the integer not to hold negative values.
CHARACTER TYPE MODIFIER The char can also be signed or unsigned. unlike int,char is not signed or unsigned by default. It is later modified to best fit the type to the hardware properties.
FLOATING POINT TYPE MODIFIERS There are three floating-point types: float, double, and long double. These types represent minimum allowable range of types. Note:- don’t use commas in numeric values assigned to variables.
ARRAYS FUNCTIONS DERIVED DATA TYPES POINTERS REFERENCES CONSTANTS
ARRAYS An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.That means that, for example, we can store 5 values of type int in an array without having to declare 5 different variables, each one with a different identifier. Instead of that, using an array we can store 5 different values of the same type, int for example, with a unique identifier. Like a regular variable, an array must be declared before it is used. A typical declaration for an array in C++ is:type name [elements]; NOTE: The elements field within brackets [ ] which represents the number of elements the array is going to hold, must be a constant value, since arrays are blocks of non-dynamic memory whose size must be determined before execution.
VALID OPERATIONS WITH ARRAYS:- billy[0] = a; billy[a] = 75; b = billy [a+2]; billy[billy[a]] = billy[2] + 5; PROGRAM:-       // arrays example #include <iostream> using namespace std;  int billy [] = {16, 2, 77, 40, 12071}; int n, result=0; int main ()                                                     OUTPUT:-   12206 {   for ( n=0 ; n<5 ; n++ )   {  result += billy[n];  }  cout << result;  return 0; }  
FUNCTIONS:- Function groups a number of program statements into a unit and gives it a name. This unit can be invoked from other parts of a program. A computer program cannot handle all the tasks by it self. Instead its requests other program like entities – called functions in C – to get its tasks done. A function is a self contained block of statements that perform a coherent task of same kind. The name of the function is unique in a C Program and is Global. It means that a function can be accessed from any location with in a C Program. We pass information to the function called arguments specified when the function is called. And the function either returns some value to the point it was called from or returns nothing. We can divide a long C program into small blocks which can perform a certain task. A function is a self contained block of statements that perform a coherent task of same kind.  We first declare the function and then at the end of the program we define the function.
POINTERS:- The memory of your computer can be imagined as a succession of memory cells, each one of the minimal size that computers manage (one byte). These single-byte memory cells are numbered in a consecutive way, so as, within any block of memory, every cell has the same number as the previous one plus one.This way, each cell can be easily located in the memory because it has a unique address and all the memory cells follow a successive pattern. For example, if we are looking for cell 1776 we know that it is going to be right between cells 1775 and 1777, exactly one thousand cells after 776 and exactly one thousand cells before cell 2776. The general form of declaring the pointer is                            type*ptr;
REFERENCES:-	 It is an alternative name for an object. A reference variable provides an alias for a previously defined variable. It’s declaration consists of  a base type, an &(ampersand), a reference variable name equated to a variable name.    the general form of declaring is:-           type&ref-var = var-name;
CONSTANTS:- C++ constants are not very different from any C++ variable. They are defined in a similar way and have the same data types and the same memory limitations. However, there is one major difference - once a constant has been created and value assigned to it then that value may not be changed. Defining Constants with C++ There are actually three ways of defining a constant in a C++ program: by using the preprocessor by using the const key word by using enumerators - these will have a range of integer values It's also worth noting that there are two types of constant: literal and symbolic.    the general form of declaring a variable is:-                    const int upperage = 50;
CLASS STRUCTURE USER DEFINED DERIVED DATA TYPES UNION ENUMERATION
CLASS Class: A class is a collection of variables and function under one reference name. it is the way of separating and storing similar data together. Member functions are often the means of accessing, modifying and operating the data members (i.e. variables). It is one of the most important features of C++ since OOP is usually implemented through the use of classes.
Classes are generally declared using the keyword class, with the following format: class class_name {  access_specifier_1:                        member1;   access_specifier_2:     member2;  ...         } object_names;
STRUCTURES:- A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Data structures are declared in C++ using the following syntax:struct structure_name {member_type1 member_name1;member_type2 member_name2;member_type3 member_name3;..} object_names;  where structure_name is a name for the structure type, object_name can be a set of valid identifiers for objects that have the type of this structure. Within braces { } there is a list with the data members, each one is specified with a type and a valid identifier as its name. Structure is different from an array in the sense that an array represents an aggregate of elements of same type whereas a structure represents an aggregate of elements of arbitrary types..
UNION:- Unions allow one same portion of memory to be accessed as different data types, since all of them are in fact the same location in memory. Its declaration and use is similar to the one of structures but its functionality is totally different: union union_name {     member_type1 member_name1;     member_type2 member_name2;     member_type3 member_name3;      .      .    } object_names; All the elements of the union declaration occupy the same physical space in memory. Its size is the one of the greatest element of the declaration.  all of them are referring to the same location in memory, the modification of one of the elements will affect the value of all of them. We cannot store different values in them independent of each other.One of the uses a union may have is to unite an elementary type with an array or structures of smaller elements.  The exact alignment and order of the members of a union in memory is platform dependant. Therefore be aware of possible portability issues with this type of use.
ENUMERATION:- It can be used to assign names to integer constants.   //Program to illustrate Enumerator   #include<iostream.h>   void main(void)   { enum type{POOR,GOOD,EXCELLENT};//this is the syntax of enumerator            int var;          var=POOR;//this makes programs more understandable          cout<<var<<endl;          var=GOOD;          cout<<var<<endl;          var=EXCELLENT;          cout<<var;      } //poor=0      good=1      excellent=2
CONCLUSION:- We have so many data types to allow the programmer to take advantage of hardware characteristics. Machines are significantly different in their memory requirements, memory access times, and computation speeds.
THANK YOU

More Related Content

What's hot

Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constants
vinay arora
 
structure and union
structure and unionstructure and union
structure and union
student
 

What's hot (20)

Union in C programming
Union in C programmingUnion in C programming
Union in C programming
 
Data types in C
Data types in CData types in C
Data types in C
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
Data types
Data typesData types
Data types
 
3 data-types-in-c
3 data-types-in-c3 data-types-in-c
3 data-types-in-c
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
 
Datatypes in c
Datatypes in cDatatypes in c
Datatypes in c
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
 
Tokens in C++
Tokens in C++Tokens in C++
Tokens in C++
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constants
 
C Structures & Unions
C Structures & UnionsC Structures & Unions
C Structures & Unions
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
 
structure and union
structure and unionstructure and union
structure and union
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
Array ppt
Array pptArray ppt
Array ppt
 

Viewers also liked

constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
Sahithi Naraparaju
 
Overview of c language
Overview of c languageOverview of c language
Overview of c language
shalini392
 
Array in c language
Array in c languageArray in c language
Array in c language
home
 
Lecture 03 data abstraction and er model
Lecture 03 data abstraction and er modelLecture 03 data abstraction and er model
Lecture 03 data abstraction and er model
emailharmeet
 

Viewers also liked (18)

Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
 
C ppt
C pptC ppt
C ppt
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
C language ppt
C language pptC language ppt
C language ppt
 
Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)
 
Data type in c
Data type in cData type in c
Data type in c
 
C pointers
C pointersC pointers
C pointers
 
C language basics
C language basicsC language basics
C language basics
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
C tokens
C tokensC tokens
C tokens
 
Data type
Data typeData type
Data type
 
About Tokens and Lexemes
About Tokens and LexemesAbout Tokens and Lexemes
About Tokens and Lexemes
 
Data types
Data typesData types
Data types
 
Overview of c language
Overview of c languageOverview of c language
Overview of c language
 
Array in c language
Array in c languageArray in c language
Array in c language
 
Lecture 03 data abstraction and er model
Lecture 03 data abstraction and er modelLecture 03 data abstraction and er model
Lecture 03 data abstraction and er model
 

Similar to Concept of c data types

cassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfcassignmentii-170424105623.pdf
cassignmentii-170424105623.pdf
YRABHI
 
C PROGRAMMING LANGUAGE
C  PROGRAMMING  LANGUAGEC  PROGRAMMING  LANGUAGE
C PROGRAMMING LANGUAGE
PRASANYA K
 
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
ssuser5610081
 
variablesfinal-170820055428 data type results
variablesfinal-170820055428 data type resultsvariablesfinal-170820055428 data type results
variablesfinal-170820055428 data type results
atifmugheesv
 

Similar to Concept of c data types (20)

Data types
Data typesData types
Data types
 
Data Handling
Data HandlingData Handling
Data Handling
 
cassignmentii-170424105623.pdf
cassignmentii-170424105623.pdfcassignmentii-170424105623.pdf
cassignmentii-170424105623.pdf
 
Fundamental of C Programming (Data Types)
Fundamental of C Programming (Data Types)Fundamental of C Programming (Data Types)
Fundamental of C Programming (Data Types)
 
C presentation! BATRA COMPUTER CENTRE
C presentation! BATRA  COMPUTER  CENTRE C presentation! BATRA  COMPUTER  CENTRE
C presentation! BATRA COMPUTER CENTRE
 
C PROGRAMMING LANGUAGE
C  PROGRAMMING  LANGUAGEC  PROGRAMMING  LANGUAGE
C PROGRAMMING LANGUAGE
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
 
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
Data Types in C++-Primary or Built-in or Fundamental data type Derived data t...
 
Sv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvmSv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvm
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++
 
variablesfinal-170820055428 data type results
variablesfinal-170820055428 data type resultsvariablesfinal-170820055428 data type results
variablesfinal-170820055428 data type results
 
Unit 4 qba
Unit 4 qbaUnit 4 qba
Unit 4 qba
 
Dot net programming concept
Dot net  programming conceptDot net  programming concept
Dot net programming concept
 
Structured Languages
Structured LanguagesStructured Languages
Structured Languages
 
Shanks
ShanksShanks
Shanks
 
Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
 
Presentation on c programing satcture
Presentation on c programing satcture Presentation on c programing satcture
Presentation on c programing satcture
 
Lecture 3.mte 407
Lecture 3.mte 407Lecture 3.mte 407
Lecture 3.mte 407
 
Datatypes
DatatypesDatatypes
Datatypes
 
DATA TYPES IN C Language.pptx
DATA TYPES IN C Language.pptxDATA TYPES IN C Language.pptx
DATA TYPES IN C Language.pptx
 

More from Manisha Keim

Environment for Class IV
Environment for Class IVEnvironment for Class IV
Environment for Class IV
Manisha Keim
 
Coordinate Geometry
Coordinate GeometryCoordinate Geometry
Coordinate Geometry
Manisha Keim
 

More from Manisha Keim (20)

National Rail Museum
National Rail MuseumNational Rail Museum
National Rail Museum
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Electricity
ElectricityElectricity
Electricity
 
Health, Hygiene and Cleanliness
Health, Hygiene and CleanlinessHealth, Hygiene and Cleanliness
Health, Hygiene and Cleanliness
 
Transport Layer Numericals
Transport Layer NumericalsTransport Layer Numericals
Transport Layer Numericals
 
Physical Layer Questions
Physical Layer QuestionsPhysical Layer Questions
Physical Layer Questions
 
Network Layer Numericals
Network Layer NumericalsNetwork Layer Numericals
Network Layer Numericals
 
Data Link Layer Numericals
Data Link Layer NumericalsData Link Layer Numericals
Data Link Layer Numericals
 
Circle
CircleCircle
Circle
 
Rational Numbers
Rational NumbersRational Numbers
Rational Numbers
 
Data Handling
Data HandlingData Handling
Data Handling
 
Environment for Class IV
Environment for Class IVEnvironment for Class IV
Environment for Class IV
 
Tsunami
TsunamiTsunami
Tsunami
 
Kabir
KabirKabir
Kabir
 
Abc Of Friendship
Abc Of FriendshipAbc Of Friendship
Abc Of Friendship
 
History of India
History of IndiaHistory of India
History of India
 
Moments
MomentsMoments
Moments
 
Coordinate Geometry
Coordinate GeometryCoordinate Geometry
Coordinate Geometry
 
Computers
ComputersComputers
Computers
 
Powepoint
PowepointPowepoint
Powepoint
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 

Concept of c data types

  • 1. CONCEPT OF C++ DATA TYPES MADE BY:- Yansi Keim XI-A
  • 2. DATA TYPES Data types are means to identify the type of data and associated operations of handling it. C++ provides a predefined set of data types for handling the data it uses. When variables are declared of a particular data type then the variable becomes the place where the data is stored and data types is the type of value(data) stored by that variable. Data can be of may types such as character, integer, real etc. since the data to be dealt with are of may types, a programming language must provide different data types.
  • 3. FUNDAMENTAL DATA TYPES DATA TYPE MODIFIERS DATA TYPES DERIVED DATA TYPES USER DEFINED DATA TYPES
  • 4. INTEGER CHARACTER FUNDAMENTAL DATA TYPES FLOAT FUNDAMENTAL DATA TYPES ARE THOSE THAT ARE NOT COMPOSED OF OTHER DATA TYPES DOUBLE VOID
  • 5. INTEGER DATA TYPE Integers are whole numbers with a machine dependent range of values. A good programming language as to support the programmer by giving a control on a range of numbers and storage space. C has 3 classes of integer storage namely short int, int and long int. All of these data types have signed and unsigned forms. A short int requires half the space than normal integer values. Unsigned numbers are always positive and consume all the bits for the magnitude of the number. The long and unsigned integers are used to declare a longer range of values.
  • 6. CHARACTER DATA TYPE It can store any member of the C++ implementation's basic character set. If a character from this set is stored in a character variable, its value is equivalent to the integer code of that character. Character data type is often called as integer data type because the memory implementation of char data type is in terms of the number code.
  • 7. FLOAT DATA TYPE A number having fractional part is a floating- point number. An identifier declared as float becomes a floating-point variable and can hold floating-point numbers. floating point variables represent real numbers. They have two advantages over integer data types:- 1: they can represent values between integers. 2: they can represent a much greater range of values. they have one disadvantage also, that is their operations are usually slower.
  • 8. The data type double is also used for handling floating-point numbers. But it is treated as a distinct data type because, it occupies twice as much memory as type float, and stores floating-point numbers with much larger range and precision. It is slower that type float. DOUBLE DATA TYPE
  • 9. VOID DATA TYPE It specifies an empty set of values. It is used as the return type for functions that do not return a value. No object of type void may be declared. It is used when program or calculation does not require any value but the syntax needs it.
  • 10. INTEGER TYPE MODIFIERS DATA TYPE MODIFIERS CHARACTER TYPEMODIFIERS THEY CHANGE SOME PROPERTIES OF THE DATA TYPE FLOATING-POINT MODIFIERS
  • 11. INTEGER TYPE MODIFIERS C++ offers three types of integer data type:- 1:- short integer- at least two bytes. 2:- int integer – at least as big as short. 3:- long integer-at least four bytes. the prefix signed makes the integer type hold negative values also. Unsigned makes the integer not to hold negative values.
  • 12.
  • 13. CHARACTER TYPE MODIFIER The char can also be signed or unsigned. unlike int,char is not signed or unsigned by default. It is later modified to best fit the type to the hardware properties.
  • 14. FLOATING POINT TYPE MODIFIERS There are three floating-point types: float, double, and long double. These types represent minimum allowable range of types. Note:- don’t use commas in numeric values assigned to variables.
  • 15.
  • 16. ARRAYS FUNCTIONS DERIVED DATA TYPES POINTERS REFERENCES CONSTANTS
  • 17. ARRAYS An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.That means that, for example, we can store 5 values of type int in an array without having to declare 5 different variables, each one with a different identifier. Instead of that, using an array we can store 5 different values of the same type, int for example, with a unique identifier. Like a regular variable, an array must be declared before it is used. A typical declaration for an array in C++ is:type name [elements]; NOTE: The elements field within brackets [ ] which represents the number of elements the array is going to hold, must be a constant value, since arrays are blocks of non-dynamic memory whose size must be determined before execution.
  • 18. VALID OPERATIONS WITH ARRAYS:- billy[0] = a; billy[a] = 75; b = billy [a+2]; billy[billy[a]] = billy[2] + 5; PROGRAM:-   // arrays example #include <iostream> using namespace std;  int billy [] = {16, 2, 77, 40, 12071}; int n, result=0; int main () OUTPUT:- 12206 { for ( n=0 ; n<5 ; n++ ) { result += billy[n]; } cout << result; return 0; }  
  • 19. FUNCTIONS:- Function groups a number of program statements into a unit and gives it a name. This unit can be invoked from other parts of a program. A computer program cannot handle all the tasks by it self. Instead its requests other program like entities – called functions in C – to get its tasks done. A function is a self contained block of statements that perform a coherent task of same kind. The name of the function is unique in a C Program and is Global. It means that a function can be accessed from any location with in a C Program. We pass information to the function called arguments specified when the function is called. And the function either returns some value to the point it was called from or returns nothing. We can divide a long C program into small blocks which can perform a certain task. A function is a self contained block of statements that perform a coherent task of same kind.  We first declare the function and then at the end of the program we define the function.
  • 20. POINTERS:- The memory of your computer can be imagined as a succession of memory cells, each one of the minimal size that computers manage (one byte). These single-byte memory cells are numbered in a consecutive way, so as, within any block of memory, every cell has the same number as the previous one plus one.This way, each cell can be easily located in the memory because it has a unique address and all the memory cells follow a successive pattern. For example, if we are looking for cell 1776 we know that it is going to be right between cells 1775 and 1777, exactly one thousand cells after 776 and exactly one thousand cells before cell 2776. The general form of declaring the pointer is type*ptr;
  • 21. REFERENCES:- It is an alternative name for an object. A reference variable provides an alias for a previously defined variable. It’s declaration consists of a base type, an &(ampersand), a reference variable name equated to a variable name. the general form of declaring is:- type&ref-var = var-name;
  • 22. CONSTANTS:- C++ constants are not very different from any C++ variable. They are defined in a similar way and have the same data types and the same memory limitations. However, there is one major difference - once a constant has been created and value assigned to it then that value may not be changed. Defining Constants with C++ There are actually three ways of defining a constant in a C++ program: by using the preprocessor by using the const key word by using enumerators - these will have a range of integer values It's also worth noting that there are two types of constant: literal and symbolic. the general form of declaring a variable is:- const int upperage = 50;
  • 23. CLASS STRUCTURE USER DEFINED DERIVED DATA TYPES UNION ENUMERATION
  • 24. CLASS Class: A class is a collection of variables and function under one reference name. it is the way of separating and storing similar data together. Member functions are often the means of accessing, modifying and operating the data members (i.e. variables). It is one of the most important features of C++ since OOP is usually implemented through the use of classes.
  • 25. Classes are generally declared using the keyword class, with the following format: class class_name { access_specifier_1: member1; access_specifier_2: member2; ... } object_names;
  • 26. STRUCTURES:- A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Data structures are declared in C++ using the following syntax:struct structure_name {member_type1 member_name1;member_type2 member_name2;member_type3 member_name3;..} object_names; where structure_name is a name for the structure type, object_name can be a set of valid identifiers for objects that have the type of this structure. Within braces { } there is a list with the data members, each one is specified with a type and a valid identifier as its name. Structure is different from an array in the sense that an array represents an aggregate of elements of same type whereas a structure represents an aggregate of elements of arbitrary types..
  • 27. UNION:- Unions allow one same portion of memory to be accessed as different data types, since all of them are in fact the same location in memory. Its declaration and use is similar to the one of structures but its functionality is totally different: union union_name { member_type1 member_name1; member_type2 member_name2; member_type3 member_name3; . . } object_names; All the elements of the union declaration occupy the same physical space in memory. Its size is the one of the greatest element of the declaration. all of them are referring to the same location in memory, the modification of one of the elements will affect the value of all of them. We cannot store different values in them independent of each other.One of the uses a union may have is to unite an elementary type with an array or structures of smaller elements. The exact alignment and order of the members of a union in memory is platform dependant. Therefore be aware of possible portability issues with this type of use.
  • 28. ENUMERATION:- It can be used to assign names to integer constants. //Program to illustrate Enumerator #include<iostream.h> void main(void) { enum type{POOR,GOOD,EXCELLENT};//this is the syntax of enumerator   int var; var=POOR;//this makes programs more understandable cout<<var<<endl; var=GOOD; cout<<var<<endl; var=EXCELLENT; cout<<var; } //poor=0 good=1 excellent=2
  • 29. CONCLUSION:- We have so many data types to allow the programmer to take advantage of hardware characteristics. Machines are significantly different in their memory requirements, memory access times, and computation speeds.