PROGLANG-DATATYPES

Cards (36)

  • Data type
    Defines a collection of data values and a set of predefined operations on those values
  • Primitive data type
    Data types that are not defined in terms of other types
  • Primitive data types
    • Numeric
    • Boolean
    • Character
  • Integer
    The most common primitive numeric data type
  • Floating-point data type

    Models real numbers, but the representations are only approximations of many real numbers
  • Decimal data type
    Stores a fixed number of decimal digits, with the decimal point at a fixed position in value
  • Boolean data type
    Has a range of values that has only two (2) elements, one for true and one for false
  • Character data type
    Used to store only a single character
  • Character string (or string) type
    Has values that consist of sequences of characters
  • Common string operations
    • Assignment
    • Concatenation
    • Substring reference
    • Comparison
    • Pattern matching
  • String length options

    • Static length string
    • Limited dynamic length string
    • Dynamic length string
  • Ordinal type
    Consists of a range of possible values that can be easily associated with the set of positive integers
  • User-defined ordinal types
    • Enumeration type
    • Subrange type
  • Array
    A container object that stores a fixed number of values of a single type
  • Categories of arrays
    • Static array
    • Fixed stack-dynamic array
    • Stack-dynamic array
    • Fixed-heap dynamic array
    • Heap-dynamic array
  • Common array operations
    • Assignment
    • Concatenation
    • Comparison for equality and inequality
    • Slices
  • Rectangular array
    A multidimensional array in which all of the rows and columns have the same number of elements
  • Jagged array

    Consists of rows with different number of elements
  • Slice
    Another array produced after extracting certain elements from an array
  • Associative array
    An unordered collection of data elements that are indexed by an equal number of values called keys
  • Record
    A collection of data elements in which the individual elements are identified by names and accessed through offsets from the beginning of the structure
  • Tuple
    A data type that is similar to a record, except that the elements are not named
  • List
    Represents an ordered sequence of values, which is usually not separated by any punctuation
  • Union
    A type whose variables may store different type of values at different times during program execution
  • Types of unions
    • Free unions
    • Discriminated unions
  • Pointer type
    One in which the variables have a range of values that consists of memory addresses and a special value called nil
  • Heap-dynamic variable

    Variables that are dynamically allocated form the heap
  • Fundamental pointer operations
    • Assignment
    • Dereferencing
  • Reference type
    A variable that refers to an object or a value in memory
  • Type checking

    The activity of ensuring that the operands of an operator are of compatible types
  • Coercion
    The process automatically converting an operator
  • Type error
    The application of an operator to an operand of an inappropriate type
  • Dynamic type checking

    Type checking at run time
  • Strongly typed programming language

    One where type errors are always detected
  • Type equivalence
    Two (2) types are equivalent if an operand of one (1) type in an expression is substituted for one of the other type, without coercion
  • Approaches to defining type equivalence
    • Name type equivalence
    • Structure type equivalence