Nội dung text P3 Notes.pdf
AS COMPUTER SCIENCE P3 2 | P A G E ABDUL REHMAN YASER Chapter 13 – Data Representation 13.1 User Defined Data Types User-defined data type – a data type based on an existing data type or other data types that have been defined by a programmer. Non-composite data type – a data type that does not reference any other data types. Some non-composite data types already in programming language are string, integer, real, date, char, Boolean. Non-composite user-defined data types are usually used for a special purpose. Single Data Type that doesn’t involve a reference to another type Enumerated data type – A user-defined non-composite data type with an ordered list of all possible values. Pointer data type – A user-defined non-composite data type used to reference a memory location. Set – a given list of unordered elements that can use set theory operations such as intersection and union. User Defined Datatype • A datatype constructed by the programmer • Derived from one or more datatypes • Used to extend built in datatypes • Created data types specific to programs Purpose of User Defined Datatype • To extend flexibility of a program • To create new datatype from existing datatypes, or two create a new datatype that meets requirements of program • No suitable datatype available in programming language
AS COMPUTER SCIENCE P3 4 | P A G E ABDUL REHMAN YASER Composite data types Array Indexed Collection of items with same data type List Indexed Collection of items that can have different data types Records Collection of related data items which may have different data types the data type for record was introduced as a composite data type because it refers to other data types. Sets