SlideShare a Scribd company logo
1 of 16
DATA TYPES
Lesson 8
MANOLO L. GIRON
RMTU
1Structure of Programming Language
DATA TYPES
• A data type defines a collection of data values and a set of
predefined operations on those values.
• Computer programs produce results by manipulating data.
• An important factor in determining the ease with which they
can perform this task is how well the data types available in
the language being used match the objects in the real-world
of the problem being addressed.
2Structure of Programming Language
Numeric Data Types
• Integer
• The most common primitive numeric data type.
• These sizes of integers, and often a few others, are supported by some programming
languages.
• Java includes four signed integer sizes: byte, short, int, and long.
• C++ and C#, include unsigned integer types, which are simply types for integer values
without signs.
• Unsigned types are often used for binary data.
• Signed integer value is represented in a computer by a string of bits, with one of the bits
(typically the leftmost) representing the sign.
3Structure of Programming Language
Numeric Data Types cont.
• Floating-Point
• Floating-point data types model real numbers, but the representations are only approximations
for many real values.
• On most computers, floating point numbers are stored in binary, which exacerbates the problem.
• Floating-point values are represented as fractions and exponents, a form that is borrowed from
scientific notation.
• Most languages include two floating-point types, often called float and double
• The float type is the standard size, usually being stored in four bytes of memory.
• The double type
• is provided for situations where larger fractional parts and/or a larger range of exponents is needed.
• Double-precision variables usually occupy twice as
• much storage as float variables and provide at least twice the number of bits of fraction.
4Structure of Programming Language
Numeric Data Types Cont.
• Decimal
• Decimal data types store a fixed number of decimal digits, with the decimal point at a
fixed position in the value.
• Decimal types have the advantage of being able to precisely store decimal values, at
least those within a restricted range, which cannot be done with floating-point.
• Decimal types are stored very much like character strings, using binary codes for the
decimal digits.
• These are the primary data types for business data processing and are therefore essential
to COBOL. C# and F# also have decimal data types.
5Structure of Programming Language
Numeric Data Types Cont.
• Complex
• Complex values are represented as ordered pairs of floating-point values.
• Some programming languages support a complex data type—for example, Fortran and
Python.
• In Python, the imaginary part of a complex literal is specified by following it with a j or
J—for example, (7 + 3j)
6Structure of Programming Language
Boolean Data Types
• Boolean types are perhaps the simplest of all types.
• Their range of values
• has only two elements: one for TRUE and one for FALSE.
• Boolean types are often used to represent switches or flags in programs.
7Structure of Programming Language
Character Types Data Types
• A character string type is one in which the values consist of sequences of
characters.
• Character string constants are used to label output, and the input and output of all
kinds of data are often done in terms of strings.
• Character string constants are used to label output, and the input and output of all
kinds of data are often done in terms of strings.
• The most common string operations are assignment, catenation, substring
reference, comparison, and pattern matching.
• C and C++ use char arrays to store character strings.
• C++ programmers should use the string class from the standard library, rather than
char arrays and the C string library.
• C# and Ruby include string classes that are similar to those of Java
8Structure of Programming Language
User-Defined Ordinal Data Types
• Enumeration Types
• An enumeration type is one in which all of the possible values, which are named constants, are
provided, or enumerated, in the definition.
• Enumeration types provide a way of defining and grouping collections of named constants, which are
called enumeration constants.
• C# example: enumdays {Mon, Tue, Wed, Thu, Fri, Sat, Sun};
• C and Pascal were the first widely used languages to include an enumeration data type. C++ includes
C’s enumeration types. In C++, we could have the following:
• enumcolors {red, blue, green, yellow, black};
• colors myColor = blue, yourColor = red;
• In ML, enumeration types are defined as new types with datatypedeclarations. For example, we could
have the following:
• datatypeweekdays = Monday | Tuesday | Wednesday | Thursday | Friday 9Structure of Programming Language
Array Data Types
• An array is a homogeneous aggregate of data elements in which an individual
element is identified by its position in the aggregate, relative to the first element.
• In many languages, such as C, C++, Java, Ada, and C#, all of the elements of an
array are required to be of the same type.
• STATIC ARRAY
• FIXED STACK-DYNAMIC ARRAY
• STACK-DYNAMIC ARRAY
• FIXED HEAP-DYNAMIC ARRAY
• HEAP-DYNAMIC ARRAY
10Structure of Programming Language
STATIC ARRAY
• A static array is one in which the subscript ranges are statically bound and
storage allocation is static (done before run time).
• The advantage of static arrays is efficiency:
• No dynamic allocation or de allocation is required.
• The disadvantage is that the storage for the array is fixed for the entire
execution time of the program
11Structure of Programming Language
FIXED STACK-DYNAMIC ARRAY
• A fixed stack-dynamic array is one in which the subscript ranges are statically
bound, but the allocation is done at declaration elaboration time during execution.
• The advantage of fixed stack-dynamic arrays over static arrays is space efficiency.
• A large array in one subprogram can use the same space as a large array in a
different subprogram, as long as both subprograms are not active at the same time.
• The same is true if the two arrays are in different blocks that are not active at the
same time. The disadvantage is the required allocation and de allocation time.
12Structure of Programming Language
STACK-DYNAMIC ARRAY
• A stack-dynamic array is one in which both the subscript ranges and the
storage allocation are dynamically bound at elaboration time.
• Once the subscript ranges are bound and the storage is allocated, however,
they remain fixed during the lifetime of the variable.
• The advantage of stack-dynamic arrays over static and fixed stack-dynamic
arrays is flexibility.
• The size of an array need not be known until the array is about to be used.
13Structure of Programming Language
FIXED HEAP-DYNAMIC ARRAY
• A fixed heap-dynamic array is similar to a fixed stack-dynamic array, in that the
subscript ranges and the storage binding are both fixed after storage is allocated.
• The differences are that both the subscript ranges and storage bindings are done
when the user program requests them during execution, and the storage is allocated
from the heap, rather than the stack.
• The advantage of fixed heap-dynamic arrays is flexibility—the array’s size always fits
the problem.
• The disadvantage is allocation time from the heap, which is longer than allocation
time from the stack.
14Structure of Programming Language
HEAP-DYNAMIC ARRAY
• A heap-dynamic array is one in which the binding of subscript ranges and
storage allocation is dynamic and can change any number of times during the
array’s lifetime.
• The advantage of heap-dynamic arrays over the others is flexibility: Arrays
can grow and shrink during program execution as the need for space
changes.
• The disadvantage is that allocation and de allocation take longer and may
happen many times during execution of the program.
15Structure of Programming Language
REFERENCES
• CONCEPTS OF
PROGRAMMING LANGUAGES
TENTH EDITION
ROBERT W. SEBESTA
Structure of Programming Language

More Related Content

What's hot

Object Oriented Programming in Java _lecture 1
Object Oriented Programming in Java _lecture 1Object Oriented Programming in Java _lecture 1
Object Oriented Programming in Java _lecture 1Mahmoud Alfarra
 
Programming languages and concepts by vivek parihar
Programming languages and concepts by vivek pariharProgramming languages and concepts by vivek parihar
Programming languages and concepts by vivek pariharVivek Parihar
 
Training on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan SanidhyaTraining on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan SanidhyaShravan Sanidhya
 
Data types in java
Data types in javaData types in java
Data types in javaHarshitaAshwani
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming languageVasavi College of Engg
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languagesNaqashAhmad14
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentationfazli khaliq
 
Classification of Programming Languages
Classification of Programming LanguagesClassification of Programming Languages
Classification of Programming LanguagesProject Student
 
Software Engineering (Project Planning & Estimation)
Software Engineering (Project Planning &  Estimation)Software Engineering (Project Planning &  Estimation)
Software Engineering (Project Planning & Estimation)ShudipPal
 
Computer Programming
Computer ProgrammingComputer Programming
Computer ProgrammingSyed Zaid Irshad
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithmrajkumar1631010038
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVAAnkita Totala
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingMoutaz Haddara
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented conceptsBG Java EE Course
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 

What's hot (20)

Object Oriented Programming in Java _lecture 1
Object Oriented Programming in Java _lecture 1Object Oriented Programming in Java _lecture 1
Object Oriented Programming in Java _lecture 1
 
Java basic
Java basicJava basic
Java basic
 
Programming languages and concepts by vivek parihar
Programming languages and concepts by vivek pariharProgramming languages and concepts by vivek parihar
Programming languages and concepts by vivek parihar
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Training on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan SanidhyaTraining on Core java | PPT Presentation | Shravan Sanidhya
Training on Core java | PPT Presentation | Shravan Sanidhya
 
Data types in java
Data types in javaData types in java
Data types in java
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 
introduction to programming languages
introduction to programming languagesintroduction to programming languages
introduction to programming languages
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
Classification of Programming Languages
Classification of Programming LanguagesClassification of Programming Languages
Classification of Programming Languages
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Software Engineering (Project Planning & Estimation)
Software Engineering (Project Planning &  Estimation)Software Engineering (Project Planning &  Estimation)
Software Engineering (Project Planning & Estimation)
 
Computer Programming
Computer ProgrammingComputer Programming
Computer Programming
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVA
 
Chapter 2.datatypes and operators
Chapter 2.datatypes and operatorsChapter 2.datatypes and operators
Chapter 2.datatypes and operators
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 

Similar to 8. data types

Java platform
Java platformJava platform
Java platformVisithan
 
332 ch07
332 ch07332 ch07
332 ch07YaQ10
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler ConstructionAhmed Raza
 
Data structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in CData structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in Cbabuk110
 
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
 
12.6-12.9.pptx
12.6-12.9.pptx12.6-12.9.pptx
12.6-12.9.pptxWinterSnow16
 
INTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageINTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageGOKULKANNANMMECLECTC
 
C programmimng basic.ppt
C programmimng basic.pptC programmimng basic.ppt
C programmimng basic.pptASIT Education
 
Algorithms-Flowcharts-Data-Types-and-Pseudocodes.pptx
Algorithms-Flowcharts-Data-Types-and-Pseudocodes.pptxAlgorithms-Flowcharts-Data-Types-and-Pseudocodes.pptx
Algorithms-Flowcharts-Data-Types-and-Pseudocodes.pptxRobertCarreonBula
 

Similar to 8. data types (20)

Java platform
Java platformJava platform
Java platform
 
Datatype
DatatypeDatatype
Datatype
 
pl12ch6.ppt
pl12ch6.pptpl12ch6.ppt
pl12ch6.ppt
 
332 ch07
332 ch07332 ch07
332 ch07
 
C language
C languageC language
C language
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
chapter 5.ppt
chapter 5.pptchapter 5.ppt
chapter 5.ppt
 
Data structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in CData structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in C
 
Ch6
Ch6Ch6
Ch6
 
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)
 
6 data types
6 data types6 data types
6 data types
 
Data.ppt
Data.pptData.ppt
Data.ppt
 
12.6-12.9.pptx
12.6-12.9.pptx12.6-12.9.pptx
12.6-12.9.pptx
 
INTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c languageINTRODUCTION TO C PROGRAMMING in basic c language
INTRODUCTION TO C PROGRAMMING in basic c language
 
C programmimng basic.ppt
C programmimng basic.pptC programmimng basic.ppt
C programmimng basic.ppt
 
C programming
C programmingC programming
C programming
 
Java introduction
Java introductionJava introduction
Java introduction
 
c++
 c++  c++
c++
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Algorithms-Flowcharts-Data-Types-and-Pseudocodes.pptx
Algorithms-Flowcharts-Data-Types-and-Pseudocodes.pptxAlgorithms-Flowcharts-Data-Types-and-Pseudocodes.pptx
Algorithms-Flowcharts-Data-Types-and-Pseudocodes.pptx
 

More from Zambales National High School

17. software for home, personal, and educational
17. software for home, personal, and educational17. software for home, personal, and educational
17. software for home, personal, and educationalZambales National High School
 

More from Zambales National High School (20)

8. digital integrated circuit
8. digital integrated circuit8. digital integrated circuit
8. digital integrated circuit
 
7. transformer and diode
7. transformer and diode7. transformer and diode
7. transformer and diode
 
5. resistor and capacitor application
5. resistor and capacitor application5. resistor and capacitor application
5. resistor and capacitor application
 
6. transistor
6. transistor6. transistor
6. transistor
 
4. resistor and capacitor
4. resistor and capacitor4. resistor and capacitor
4. resistor and capacitor
 
2. Basic Electronics Circuit
2. Basic Electronics Circuit2. Basic Electronics Circuit
2. Basic Electronics Circuit
 
3. basic electrical and electronic symbol
3. basic electrical and electronic symbol3. basic electrical and electronic symbol
3. basic electrical and electronic symbol
 
11. abstraction and capsulation
11. abstraction and capsulation11. abstraction and capsulation
11. abstraction and capsulation
 
10. sub program
10. sub program10. sub program
10. sub program
 
9. control statement
9. control statement9. control statement
9. control statement
 
7. name binding and scopes
7. name binding and scopes7. name binding and scopes
7. name binding and scopes
 
6. describing syntax and semantics
6. describing syntax and semantics6. describing syntax and semantics
6. describing syntax and semantics
 
5. evolution
5. evolution5. evolution
5. evolution
 
4. processor
4. processor4. processor
4. processor
 
3. criteria
3. criteria3. criteria
3. criteria
 
2. pl domain
2. pl domain2. pl domain
2. pl domain
 
1. reason why study spl
1. reason why study spl1. reason why study spl
1. reason why study spl
 
18. the components of the system unit
18. the components of the system unit18. the components of the system unit
18. the components of the system unit
 
17. software for home, personal, and educational
17. software for home, personal, and educational17. software for home, personal, and educational
17. software for home, personal, and educational
 
16. graphics and multimedia software
16. graphics and multimedia software16. graphics and multimedia software
16. graphics and multimedia software
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 

Recently uploaded (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 

8. data types

  • 1. DATA TYPES Lesson 8 MANOLO L. GIRON RMTU 1Structure of Programming Language
  • 2. DATA TYPES • A data type defines a collection of data values and a set of predefined operations on those values. • Computer programs produce results by manipulating data. • An important factor in determining the ease with which they can perform this task is how well the data types available in the language being used match the objects in the real-world of the problem being addressed. 2Structure of Programming Language
  • 3. Numeric Data Types • Integer • The most common primitive numeric data type. • These sizes of integers, and often a few others, are supported by some programming languages. • Java includes four signed integer sizes: byte, short, int, and long. • C++ and C#, include unsigned integer types, which are simply types for integer values without signs. • Unsigned types are often used for binary data. • Signed integer value is represented in a computer by a string of bits, with one of the bits (typically the leftmost) representing the sign. 3Structure of Programming Language
  • 4. Numeric Data Types cont. • Floating-Point • Floating-point data types model real numbers, but the representations are only approximations for many real values. • On most computers, floating point numbers are stored in binary, which exacerbates the problem. • Floating-point values are represented as fractions and exponents, a form that is borrowed from scientific notation. • Most languages include two floating-point types, often called float and double • The float type is the standard size, usually being stored in four bytes of memory. • The double type • is provided for situations where larger fractional parts and/or a larger range of exponents is needed. • Double-precision variables usually occupy twice as • much storage as float variables and provide at least twice the number of bits of fraction. 4Structure of Programming Language
  • 5. Numeric Data Types Cont. • Decimal • Decimal data types store a fixed number of decimal digits, with the decimal point at a fixed position in the value. • Decimal types have the advantage of being able to precisely store decimal values, at least those within a restricted range, which cannot be done with floating-point. • Decimal types are stored very much like character strings, using binary codes for the decimal digits. • These are the primary data types for business data processing and are therefore essential to COBOL. C# and F# also have decimal data types. 5Structure of Programming Language
  • 6. Numeric Data Types Cont. • Complex • Complex values are represented as ordered pairs of floating-point values. • Some programming languages support a complex data type—for example, Fortran and Python. • In Python, the imaginary part of a complex literal is specified by following it with a j or J—for example, (7 + 3j) 6Structure of Programming Language
  • 7. Boolean Data Types • Boolean types are perhaps the simplest of all types. • Their range of values • has only two elements: one for TRUE and one for FALSE. • Boolean types are often used to represent switches or flags in programs. 7Structure of Programming Language
  • 8. Character Types Data Types • A character string type is one in which the values consist of sequences of characters. • Character string constants are used to label output, and the input and output of all kinds of data are often done in terms of strings. • Character string constants are used to label output, and the input and output of all kinds of data are often done in terms of strings. • The most common string operations are assignment, catenation, substring reference, comparison, and pattern matching. • C and C++ use char arrays to store character strings. • C++ programmers should use the string class from the standard library, rather than char arrays and the C string library. • C# and Ruby include string classes that are similar to those of Java 8Structure of Programming Language
  • 9. User-Defined Ordinal Data Types • Enumeration Types • An enumeration type is one in which all of the possible values, which are named constants, are provided, or enumerated, in the definition. • Enumeration types provide a way of defining and grouping collections of named constants, which are called enumeration constants. • C# example: enumdays {Mon, Tue, Wed, Thu, Fri, Sat, Sun}; • C and Pascal were the first widely used languages to include an enumeration data type. C++ includes C’s enumeration types. In C++, we could have the following: • enumcolors {red, blue, green, yellow, black}; • colors myColor = blue, yourColor = red; • In ML, enumeration types are defined as new types with datatypedeclarations. For example, we could have the following: • datatypeweekdays = Monday | Tuesday | Wednesday | Thursday | Friday 9Structure of Programming Language
  • 10. Array Data Types • An array is a homogeneous aggregate of data elements in which an individual element is identified by its position in the aggregate, relative to the first element. • In many languages, such as C, C++, Java, Ada, and C#, all of the elements of an array are required to be of the same type. • STATIC ARRAY • FIXED STACK-DYNAMIC ARRAY • STACK-DYNAMIC ARRAY • FIXED HEAP-DYNAMIC ARRAY • HEAP-DYNAMIC ARRAY 10Structure of Programming Language
  • 11. STATIC ARRAY • A static array is one in which the subscript ranges are statically bound and storage allocation is static (done before run time). • The advantage of static arrays is efficiency: • No dynamic allocation or de allocation is required. • The disadvantage is that the storage for the array is fixed for the entire execution time of the program 11Structure of Programming Language
  • 12. FIXED STACK-DYNAMIC ARRAY • A fixed stack-dynamic array is one in which the subscript ranges are statically bound, but the allocation is done at declaration elaboration time during execution. • The advantage of fixed stack-dynamic arrays over static arrays is space efficiency. • A large array in one subprogram can use the same space as a large array in a different subprogram, as long as both subprograms are not active at the same time. • The same is true if the two arrays are in different blocks that are not active at the same time. The disadvantage is the required allocation and de allocation time. 12Structure of Programming Language
  • 13. STACK-DYNAMIC ARRAY • A stack-dynamic array is one in which both the subscript ranges and the storage allocation are dynamically bound at elaboration time. • Once the subscript ranges are bound and the storage is allocated, however, they remain fixed during the lifetime of the variable. • The advantage of stack-dynamic arrays over static and fixed stack-dynamic arrays is flexibility. • The size of an array need not be known until the array is about to be used. 13Structure of Programming Language
  • 14. FIXED HEAP-DYNAMIC ARRAY • A fixed heap-dynamic array is similar to a fixed stack-dynamic array, in that the subscript ranges and the storage binding are both fixed after storage is allocated. • The differences are that both the subscript ranges and storage bindings are done when the user program requests them during execution, and the storage is allocated from the heap, rather than the stack. • The advantage of fixed heap-dynamic arrays is flexibility—the array’s size always fits the problem. • The disadvantage is allocation time from the heap, which is longer than allocation time from the stack. 14Structure of Programming Language
  • 15. HEAP-DYNAMIC ARRAY • A heap-dynamic array is one in which the binding of subscript ranges and storage allocation is dynamic and can change any number of times during the array’s lifetime. • The advantage of heap-dynamic arrays over the others is flexibility: Arrays can grow and shrink during program execution as the need for space changes. • The disadvantage is that allocation and de allocation take longer and may happen many times during execution of the program. 15Structure of Programming Language
  • 16. REFERENCES • CONCEPTS OF PROGRAMMING LANGUAGES TENTH EDITION ROBERT W. SEBESTA Structure of Programming Language