Basic Data Types
- Integer whole number eg 7
- Real/float decimal point eg 7.2
Alphanumeric data types
- Char a single character, Digit or symbol eg C
- String several characters grouped together eg Mr Smith
Boolean
- A data can only have one of two values (TRUE or FALSE, 1 or 0)
Array Definition
- A data structure that contains server data items
- of the same data type
- Grouped together with one name
- Individual items are accessed using an index
- Stored contiguously in computer memory
Use
- Instead of having variables that we have to declare at front, we can use a list, the software can go through the list easily and find the variable in the list easily.
- Fewer variables.
- Use iteration to go through the list with the given variable instead of going through each variable to find the given variable.
- They are dynamic, can change the program as it is running.
Array Declaration
- Identifier/name
- Data type
- Dimension (1 or 2) One dimension has only has one row two dimension has a row and column.
- All arrays start at index 0
No comments:
Post a Comment