CSC 351 - Chapter 6 Flashcards
data type
defines a collection of values and a set of predefined operations on those values.
user-defined types
improved readability by using meaningful names and allow changeability
abstract data type
the interface of a type is separated from the representation and set of operations on values of the type
descriptor
collection of the attributes of a variable
primitive data types
data types that are not defined in terms of other types
numeric types - floating point, integer, complex, decimal, boolean, character
character string type
values consist of sequences of characters. Character string constants are used to label output, and the input and output of all kinds are often done in terms of strings.
character string type design issues
- should strings be a special kind of character array or a primitive type
- should strings have static or dynamic length
string operations
assignment, catenation, substring reference, comparison and pattern matching
static length string
length is static and set when the string is created
limited dynamic length string
allow strings to have varying length up to a declared and fixed maximum set by the variables definition
dynamic length string
allow strings to have varying length with no maximum
ordinal type
the range of possible values can easily be associated with the set of positive integers
user-defined ordinal types
- enumeration
- subrange
enumeration types
possible values are provided in the definition. they provide a way of defining and grouping collections of named constants. they can enhance readability and reliability.
subrange types
a contiguous subsequence of an ordinal type. can enhance readability and reliability
array types
homogeneous aggregate of data elements in which an individual element is identified by its position. the individual data elements are of the same type.
static array
subscript ranges are statically bound and storage allocation is done before run time. this is efficient but the storage size is fixed.
fixed stack-dynamic array
subscript ranges are statically bound and storage allocation is done during execution. this is space efficient