Data Types

Created time
TagsA2C16Notes

What does it mean by data type

Primitive data types VS non-primitive data types

Primitive data types: The data types that are supported by computer hardware

Non-primitive data type:

By value/ By reference.

Bulld-in data types VS user-defined data types

build-in data types

(1) The programming language defines the range of possible values that can be assigned to a variable when its type has been chosen

(2)

User defined data types

1. What does it mean by the user:

The programmer who use the certain programming language to write the programme

2. A user-defined data type is defined by the user:

The possible values; The operations that can be performed

3. Not all programming languages support user-defined data type

4. Once a user-defined data type is define, variables of this type can be decalred and uses.

Why is user-defined data types are necessary

Conposite data types VS non-composite data types

A composit data type or compound data type:

any data type that is constructured using primative data types and other composite types.

Non-composite data type:

Defined without other data types.

Example:

Non-composited data type VS enumerated data type:

A non-composite data type is one which has a definition which does

Enumerated data type

Two examples of enumerated data type definitions:

TYPE Directions = (North, East, South, West)

TYPE TDays = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)

Note: the format of the definitions on our text book is not correct

Variables can be declared and assigned values, for example:

Composite user defined data types

A composite user-defined data type has a definition with reference to at least one other type.

Very important examples of composite user-defined data type.

The class.

We’ll talk more details about class later in chapter 27

Pointer data type

A pointer variable is one for which the value is a reference to a memory location.

Example:

Pointer data type

-Not all programming languages offer support for the use of a pointer data type. Those languages that do so will have their own version of the symbolism illustrated above with ^and@.

Set data type

Features:

  1. It contains a collection of data values.
  1. There is no organization of the data values within the set. -> how the data values are organized is unveiled.
  1. Duplicare values are not allowed.
  1. Operations that can be performed on a ser include:
  1. – checking if a value exists in a set
  1. – adding a new data value
  1. – removing an existing data value
  1. – adding one set to another set.
  1. – get the intersection of 2 sets
  1. – get the union of 2 sets
  1. Python offers the support of set data type.

Conclusion

Different kinds of data types