Data Types
Programs need to use data for calculations, comparisons, and for output
to various devices. The best programs will allways use the most appropriate
data types to make the most effective use of memory and to ensure that only the
correct types of data are allowed to be input.
A variable can be declared to have a data type, including:
= character – allows any single letter or number
= string – allows any combination of letters, numbers and spaces
= integer – for whole numbers
= real – for numbers with whole parts and fractional parts
= Boolean – can only hold true or false
Data
structures
Programs allow the use of data structures with variables including
records and simple arrays. They are defined below:
-
A record, data structure contains fields to store
information In a similar way to a database table.
-
An array of data structure is a variable with many
parts, in simple terms they can be thought of as tables with a number of rows
and columns. The array has a number inside brackets (called subscript), which
is used to identify an item in the array that is required. For example: an
array named customer(100) that has just one column and 100 rows, so custome(12)
would be the contents of item number 12 in the list 0 to 99.
No comments:
Post a Comment