Feb15 - CSE262: Programming Languages Instructor: Dr. Liang...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE262: Programming Languages Instructor: Dr. Liang Cheng Department of Computer Science and Engineering Lehigh University February 15, 2007
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/15/07 Outline ± Recap ± Data types (Chapter 6) ± Summary and homework
Background image of page 2
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/15/07 Data Types ± Primitive data types ± Character string types ± User-defined ordinal types ± Array types ± Record types ± Union types ± Pointer types
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/15/07 Definition ± An ordinal type is one in which the range of possible values can be easily associated with the set of positive integers ± Example ± Primitive: integer , char , boolean in Java ± User-defined: enumeration and subrange ± Primitive data types ± Character string types ± User-defined ordinal types
Background image of page 4
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/15/07 Enumeration Types ± One in which the user enumerates all of the possible values, which are symbolic constants ± enum days {Mon, Tue, Wed, Thu, Fri, Sat, Sun} ± Aid readability and reliability ± Design issues ± Should a symbolic constant be allowed to be in more than one type definition? ± Are enumeration values coerced to integer? ± Are any other types coerced to an enumeration type? ± Primitive data types ± Character string types ± User-defined ordinal types
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/15/07 Subrange Types ± An ordered contiguous subsequence of an ordinal type ± Examples ± Ada - Subtypes are not new types, just constrained existing types (so they are compatible) type Days is (Mon, Tue, Wed, Thu, Fri, Sat, Sun); subtype Weekdays is Days range Mon. .Fri; Day1 : Days; Day2 : Weekdays; Day2 := Day1; ± Evaluation ± Aid to readability ± Reliability - restricted ranges add error detection ± Primitive data types ± Character string types ± User-defined ordinal types
Background image of page 6
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/15/07 Implementation ± Implementation of user-defined ordinal types ± Enumeration types are implemented as integers ± Subrange types are the parent types with code inserted (by the compiler) to restrict assignments to subrange variables ± Primitive data types ± Character string types ± User-defined ordinal types
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/15/07 Data Types ± Primitive data types ± Character string types ± User-defined ordinal types ± Array types ± Record types ± Union types ± Pointer types
Background image of page 8
Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/15/07 Definition ± An array is an aggregate of homogeneous data elements in which an individual element is identified by its position in the aggregate, relative to the first element. ± Indexing
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/06/2008 for the course CSE 262 taught by Professor Cheng during the Spring '07 term at Lehigh University .

Page1 / 36

Feb15 - CSE262: Programming Languages Instructor: Dr. Liang...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online