Non-Composite User defined Data Type Flashcards
State what is meant by a non-composite data type
It is a type that does not involve a reference to another type
Give examples of non-composite data types
Integer, Real, String, Char, Pointer…
State what is the requirement for using a built-in data type
It has to be given an identifier
State a difference between a built in data type and a user defined data type
User defined data types have to be defined before it is given an identifier
Give examples of non-composite user defined data types
Enumerated Data Type and Pointer Data Type
State what is meant by an enumerated data type
It defines a list of possible values
Write some pseudocode for enumerated data types and how variables can be declared
TYPE TDirections = (North, East, South, West) TDays = (Monday, Tuesday) DECLARE Direction1: TDirections DECLARE StartDay: TDays Direction1
How are values defined in an enumerated data type?
Ordinal - order of values
Give an advantage of using ordinal values for enumerated data types
Allows for comparison statement i.e.
Weekend = TRUE IF Day > Friday
State what is meant by a Pointer Data Type
A pointer data type is used to reference a memory location.
State when a Pointer Data Type could be used
To construct dynamically varying data structures
State a rule about Pointer Data Types and how they point
The pointer definition has to relate to the type of the variable that is being pointed to
Write the pseudo code for a Pointer Data Type and declare a variable
TYPE TMyPointer = ^ DECLARE: MyPointer: TMyPointer ValuePointedTo
When a pointer variable is used to access the value stored at the address pointed to - what is another name for this
The pointer reference is ‘deferenced’