| «‹ July 2026 ›» | | S | M | T | W | T | F | S | | | | 1 | 2 | 3 | 4 | | 5 | 6 | 7 | 8 | 9 | 10 | 11 | | 12 | 13 | 14 | 15 | 16 | 17 | 18 | | 19 | 20 | 21 | 22 | 23 | 24 | 25 | | 26 | 27 | 28 | 29 | 30 | 31 | |
|
2009 年 9 月 11 日 星期五  |
| Data Type |
分類: Programming Language |
High-level Programming Language (Pascal)
Data Types
- determines how the value is represented in the memory
- Pascal provides a number of predefined data types
- denoted by the standard identifiers integer, real, boolean, char and reserved word string
|
Data Types
|
Descriptions
|
|
integer
|
- are whole numbers that can be positive, zero or negative
- no decimal points, blank spaces or commas between digits
- not all integers can be represented because of the limitation of memory in the computer
- in Turbo Pascal, the acceptable range of integers is between 32767 and -32768
- can perform calculation
|
|
real
|
- numbers containing decimal points
- no blank spaces or commas between digits
- can be expressed in either in decimal notation or in exponential notation for example,
- (i) 125.2 (in decimal notation)
- (ii) 1.252E+02 (in exponential notation)
- real constant must have at least one digit before and after the decimal point
- can perform calculation
|
|
boolean
|
- has two values only : true and false
- used to represented conditional value and decision-making
|
|
char
|
- can be a letter, a numeric digit, a punctuation symbol or a special symbol
- one of the symbol in ASCII character set
- consists of a single character enclosed within a pair of single quotation marks e.g. 'A', '8', '+'
- if the character is an apostrophe ( ' ), it must appear as a pair of apostrophes enclosed within a pair of single quotation marks i.e. ' " '
- cannot perform calculation directly
|
|
string
|
- a sequence of zero or more (up to 255) characters enclosed in a pair of single quotation marks
- null string contains no character
- cannot perform calculation directly
|
|
|