SlideShare a Scribd company logo
Datatype in C++
•Data type is a keyword used to identify type of data.
•It is used for storing the input of the program into
the main memory (RAM) of the computer by
allocating sufficient amount of memory space in the
main memory of the computer.
•In general every programming language is containing
three categories of data types. They are
1. Fundamental or primitive data types
2. Derived data types
3. User defined data types
Primitive data types
These are the data types whose variable can hold
maximum one value at a time, in C++ language it
can be achieve by int, float, double, char.
Derived data types
1. These data type are derived from fundamental
data type.
2. Variables of derived data type allow us to store
multiple values of same type in one variable but
never allows to store multiple values of different
types.
User defined data types
1. User defined data types related variables allows us
to store multiple values either of same type or
different type or both.
2. This is a data type whose variable can hold more
than one value of dissimilar type, in C++ language
it is achieved by structure.
Data type modifiers
• The data type modifiers are listed here:
1. signed
2. unsigned
3. long
4. Short
• The modifiers signed, unsigned,
long, and short can be applied to integer base
types.
• In addition, signed and unsignedcan be applied to
char, and long can be applied to double.
Constants/Literals
• Constants refer to fixed values that the program may
not alter and they are called literals.
• Constants can be of any of the basic data types and can
be divided into Integer Numerals, Floating-Point
Numerals, Characters, Strings and Boolean Values.
C++ allows several kinds of literal
1. Integer literals
2. Floating-point literals
3. Boolean literals
4. Character literals
5. String literals
Integer Constants
• An integer literal can be a decimal, octal, or
hexadecimal constant.
• A prefix specifies the base or radix: 0x or 0X for
hexadecimal, 0 for octal, and nothing for decimal.
• An integer literal can also have a suffix that is a
combination of U and L, for unsigned and long,
respectively.
Floating-point Constants
• A floating-point literal has an integer part, a decimal
point, a fractional part, and an exponent part.
Boolean Constants
• There are two Boolean literals and they are part of
standard C++ keywords:
1. A value of true representing true.
2. A value of false representing false.
• You should not consider the value of true equal to 1
and value of false equal to 0.
Character Constants
• Character literals are enclosed in single quotes.
String Constants
• String literals are enclosed in double quotes.
• A string contains characters that are similar to
character literals: plain characters, escape
sequences, and universal characters.
The const Keyword
Variable Declaration Rule in C++
• To Declare any variable in C++ you need to follow rules and
regulation of C++ Language, which is given below;
• Every variable name should start with alphabets or
underscore (_).
• No spaces are allowed in variable declaration.
• Except underscore (_) no special symbol are allowed in the
middle of the variable declaration.
• Maximum length of variable is 8 characters depend on
compiler and operation system.
• Every variable name always should exist in the left hand side
of assignment operator.
• No keyword should access variable name.
Syntax:
Datatype variable_name;
int a;
Scope of Variable in C++
• In C++ language, a variable can be either of global
or local scope.
Global variable
1. Global variables are defined outside of all the
functions, generally on top of the program.
2. The global variables will hold their value
throughout the life-time of your program.
Local variable
1. A local variable is declared within the body of a
function or a block.
2. Local variable only use within the function or block
where it is declare.
Datatype in c++ unit 3 -topic 2

More Related Content

What's hot

Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
Manoj Tyagi
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
Muhammad Waqas
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
programming9
 
Functions in C
Functions in CFunctions in C
Functions in C
Kamal Acharya
 
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++
Neeru Mittal
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
03062679929
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
tanmaymodi4
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
Ashok Raj
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
Neeru Mittal
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
HalaiHansaika
 
C tokens
C tokensC tokens
C tokens
Manu1325
 
Tokens in C++
Tokens in C++Tokens in C++
Tokens in C++
Mahender Boda
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
Way2itech
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
Prof. Dr. K. Adisesha
 
Data types in C
Data types in CData types in C
Data types in C
Tarun Sharma
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
Muhammad Hammad Waseem
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
Qazi Shahzad Ali
 
Templates in C++
Templates in C++Templates in C++
Templates in C++Tech_MX
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
Mohammed Sikander
 

What's hot (20)

Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
Functions in C
Functions in CFunctions in C
Functions in C
 
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++
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 
C tokens
C tokensC tokens
C tokens
 
Tokens in C++
Tokens in C++Tokens in C++
Tokens 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
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
Data types in C
Data types in CData types in C
Data types in C
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 

Viewers also liked

Calculus II - 15
Calculus II - 15Calculus II - 15
Calculus II - 15
David Mao
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
k v
 
Apa style-1 (1)
Apa style-1 (1)Apa style-1 (1)
Apa style-1 (1)
Nicolas Jia Quan
 
General Tips to Overcome an Interview
General Tips to Overcome an InterviewGeneral Tips to Overcome an Interview
General Tips to Overcome an Interview
Pratik Patel
 
C data_structures
C  data_structuresC  data_structures
C data_structures
Tushar Desarda
 
Calculus II - 16
Calculus II - 16Calculus II - 16
Calculus II - 16
David Mao
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
Rai University
 
Basics of Networks ,Advantages and Disadvantages
Basics of  Networks ,Advantages and DisadvantagesBasics of  Networks ,Advantages and Disadvantages
Basics of Networks ,Advantages and Disadvantages
sabari Giri
 
c++ programming Unit 1 introduction to c++
c++ programming Unit 1  introduction to c++c++ programming Unit 1  introduction to c++
c++ programming Unit 1 introduction to c++
AAKASH KUMAR
 
Presentation on C++ Programming Language
Presentation on C++ Programming LanguagePresentation on C++ Programming Language
Presentation on C++ Programming Language
satvirsandhu9
 
ppt of VCLA
ppt of VCLAppt of VCLA
ppt of VCLA
Nirali Akabari
 
Curves and surfaces
Curves and surfacesCurves and surfaces
Curves and surfaces
Mohammed Mahmoud
 
Earthing Concepts
Earthing ConceptsEarthing Concepts
Earthing Concepts
mvrkprasad
 
Electrical grounding and earthing
Electrical grounding and earthingElectrical grounding and earthing
Electrical grounding and earthing
Nitesh Dash
 
Electrical grounding and earthing systems
Electrical grounding and earthing systemsElectrical grounding and earthing systems
Electrical grounding and earthing systemsBiswajit Pratihari
 
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
Kamal Acharya
 

Viewers also liked (18)

Calculus II - 15
Calculus II - 15Calculus II - 15
Calculus II - 15
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 
Apa style-1 (1)
Apa style-1 (1)Apa style-1 (1)
Apa style-1 (1)
 
General Tips to Overcome an Interview
General Tips to Overcome an InterviewGeneral Tips to Overcome an Interview
General Tips to Overcome an Interview
 
C data_structures
C  data_structuresC  data_structures
C data_structures
 
Calculus II - 16
Calculus II - 16Calculus II - 16
Calculus II - 16
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
Basics of Networks ,Advantages and Disadvantages
Basics of  Networks ,Advantages and DisadvantagesBasics of  Networks ,Advantages and Disadvantages
Basics of Networks ,Advantages and Disadvantages
 
c++ programming Unit 1 introduction to c++
c++ programming Unit 1  introduction to c++c++ programming Unit 1  introduction to c++
c++ programming Unit 1 introduction to c++
 
C++ data types
C++ data typesC++ data types
C++ data types
 
Chap 2(const var-datatype)
Chap 2(const var-datatype)Chap 2(const var-datatype)
Chap 2(const var-datatype)
 
Presentation on C++ Programming Language
Presentation on C++ Programming LanguagePresentation on C++ Programming Language
Presentation on C++ Programming Language
 
ppt of VCLA
ppt of VCLAppt of VCLA
ppt of VCLA
 
Curves and surfaces
Curves and surfacesCurves and surfaces
Curves and surfaces
 
Earthing Concepts
Earthing ConceptsEarthing Concepts
Earthing Concepts
 
Electrical grounding and earthing
Electrical grounding and earthingElectrical grounding and earthing
Electrical grounding and earthing
 
Electrical grounding and earthing systems
Electrical grounding and earthing systemsElectrical grounding and earthing systems
Electrical grounding and earthing systems
 
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
 

Similar to Datatype in c++ unit 3 -topic 2

C language
C languageC language
C language
Rupanshi rawat
 
lec 2.pptx
lec 2.pptxlec 2.pptx
lec 2.pptx
AhsanAli64749
 
Escape Sequences and Variables
Escape Sequences and VariablesEscape Sequences and Variables
Escape Sequences and Variables
yarkhosh
 
Csc240 -lecture_4
Csc240  -lecture_4Csc240  -lecture_4
Csc240 -lecture_4
Ainuddin Yousufzai
 
SPC Unit 2
SPC Unit 2SPC Unit 2
SPC Unit 2
SIMONTHOMAS S
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
RohanJoshi290109
 
unit2.pptx
unit2.pptxunit2.pptx
unit2.pptx
sscprep9
 
C language ppt
C language pptC language ppt
C language ppt
Ğäùråv Júñêjå
 
history of c.ppt
history of c.ppthistory of c.ppt
history of c.ppt
arpanabharani
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming Language
Zubayer Farazi
 
Aniket tore
Aniket toreAniket tore
Aniket tore
anikettore1
 
CS4443 - Modern Programming Language - I Lecture (2)
CS4443 - Modern Programming Language - I  Lecture (2)CS4443 - Modern Programming Language - I  Lecture (2)
CS4443 - Modern Programming Language - I Lecture (2)
Dilawar Khan
 
C Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptxC Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptx
Murali M
 
Data types slides by Faixan
Data types slides by FaixanData types slides by Faixan
Data types slides by Faixan
ٖFaiXy :)
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
SangramNayak23
 
C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1
Ali Raza Jilani
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
TanuGohel
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
ssuserc8fc691
 
Funa-C.ppt
Funa-C.pptFuna-C.ppt
Funa-C.ppt
ssuser5ad1571
 

Similar to Datatype in c++ unit 3 -topic 2 (20)

C language
C languageC language
C language
 
lec 2.pptx
lec 2.pptxlec 2.pptx
lec 2.pptx
 
Escape Sequences and Variables
Escape Sequences and VariablesEscape Sequences and Variables
Escape Sequences and Variables
 
Csc240 -lecture_4
Csc240  -lecture_4Csc240  -lecture_4
Csc240 -lecture_4
 
SPC Unit 2
SPC Unit 2SPC Unit 2
SPC Unit 2
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
unit2.pptx
unit2.pptxunit2.pptx
unit2.pptx
 
C language ppt
C language pptC language ppt
C language ppt
 
history of c.ppt
history of c.ppthistory of c.ppt
history of c.ppt
 
CSE 1201: Structured Programming Language
CSE 1201: Structured Programming LanguageCSE 1201: Structured Programming Language
CSE 1201: Structured Programming Language
 
Aniket tore
Aniket toreAniket tore
Aniket tore
 
CS4443 - Modern Programming Language - I Lecture (2)
CS4443 - Modern Programming Language - I  Lecture (2)CS4443 - Modern Programming Language - I  Lecture (2)
CS4443 - Modern Programming Language - I Lecture (2)
 
C Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptxC Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptx
 
Data types slides by Faixan
Data types slides by FaixanData types slides by Faixan
Data types slides by Faixan
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1C++ Basics introduction to typecasting Webinar Slides 1
C++ Basics introduction to typecasting Webinar Slides 1
 
Basics of c
Basics of cBasics of c
Basics of c
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Funa-C.ppt
Funa-C.pptFuna-C.ppt
Funa-C.ppt
 

Recently uploaded

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 

Recently uploaded (20)

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 

Datatype in c++ unit 3 -topic 2

  • 1. Datatype in C++ •Data type is a keyword used to identify type of data. •It is used for storing the input of the program into the main memory (RAM) of the computer by allocating sufficient amount of memory space in the main memory of the computer. •In general every programming language is containing three categories of data types. They are 1. Fundamental or primitive data types 2. Derived data types 3. User defined data types
  • 2.
  • 3. Primitive data types These are the data types whose variable can hold maximum one value at a time, in C++ language it can be achieve by int, float, double, char.
  • 4.
  • 5. Derived data types 1. These data type are derived from fundamental data type. 2. Variables of derived data type allow us to store multiple values of same type in one variable but never allows to store multiple values of different types.
  • 6. User defined data types 1. User defined data types related variables allows us to store multiple values either of same type or different type or both. 2. This is a data type whose variable can hold more than one value of dissimilar type, in C++ language it is achieved by structure.
  • 7. Data type modifiers • The data type modifiers are listed here: 1. signed 2. unsigned 3. long 4. Short • The modifiers signed, unsigned, long, and short can be applied to integer base types. • In addition, signed and unsignedcan be applied to char, and long can be applied to double.
  • 8.
  • 9.
  • 10. Constants/Literals • Constants refer to fixed values that the program may not alter and they are called literals. • Constants can be of any of the basic data types and can be divided into Integer Numerals, Floating-Point Numerals, Characters, Strings and Boolean Values. C++ allows several kinds of literal 1. Integer literals 2. Floating-point literals 3. Boolean literals 4. Character literals 5. String literals
  • 11. Integer Constants • An integer literal can be a decimal, octal, or hexadecimal constant. • A prefix specifies the base or radix: 0x or 0X for hexadecimal, 0 for octal, and nothing for decimal. • An integer literal can also have a suffix that is a combination of U and L, for unsigned and long, respectively.
  • 12. Floating-point Constants • A floating-point literal has an integer part, a decimal point, a fractional part, and an exponent part.
  • 13. Boolean Constants • There are two Boolean literals and they are part of standard C++ keywords: 1. A value of true representing true. 2. A value of false representing false. • You should not consider the value of true equal to 1 and value of false equal to 0.
  • 14. Character Constants • Character literals are enclosed in single quotes.
  • 15. String Constants • String literals are enclosed in double quotes. • A string contains characters that are similar to character literals: plain characters, escape sequences, and universal characters.
  • 17. Variable Declaration Rule in C++ • To Declare any variable in C++ you need to follow rules and regulation of C++ Language, which is given below; • Every variable name should start with alphabets or underscore (_). • No spaces are allowed in variable declaration. • Except underscore (_) no special symbol are allowed in the middle of the variable declaration. • Maximum length of variable is 8 characters depend on compiler and operation system. • Every variable name always should exist in the left hand side of assignment operator. • No keyword should access variable name. Syntax: Datatype variable_name; int a;
  • 18. Scope of Variable in C++ • In C++ language, a variable can be either of global or local scope. Global variable 1. Global variables are defined outside of all the functions, generally on top of the program. 2. The global variables will hold their value throughout the life-time of your program. Local variable 1. A local variable is declared within the body of a function or a block. 2. Local variable only use within the function or block where it is declare.