Question:
What are the different data types in Pascal Programming?
Lucy1993
2009-03-03 17:33:35 UTC
You know like in Programming, there are different data types right. Well the Programming that my school is studying, is Pascal. There is this data type, when you are introducing the variables, called "Integer".
It usually goes like this:
Var
Num1,Num2,Num3:Integer
or something of the sort.
I need, for homework, to find out the different data types there are. I can't seem to find the information I need, probably because I don't really know what I'm looking for.
Can you please help me? I am most grateful for you kindness toward me. Thank you sooo much in advance for your help.
Yours truly,
Lucy.
Four answers:
Derek
2009-03-03 17:36:53 UTC
Here are all the Pascal date types:

http://cs.nyu.edu/courses/fall99/A22.0002-003/variables.html



Or to cut right to the chase:

* integer Whole numbers from -32768 to 32767

* byte The integers from 0 to 255

* real Floating point numbers from 1E-38 to 1E+38

* boolean Can only have the value TRUE or FALSE

* char Any character in the ASCII character set

* shortint The integers from -128 to 127

* word The integers from 0 to 65535

* longint The integers from -2147483648 to 2147483647
Odie
2009-03-03 17:39:13 UTC
here they are

Definitions:

Variable: provides temporary storage of data.

Data Type: defines the type of data that will be stored in a variable.

VAR Heading: every variable must be assigned a data type and given a unique name. Declaration of variables must be done in the VAR heading section.

Overview of Pascal Data Types:

Name Type of Data Examples

String Holds Text 'New York', 'Evan'

Integer Holds whole numbers 3, 6, 1024

Real Holds Decimal Numbers 3.14, 503.2

Boolean Holds True or False TRUE, FALSE

Character Holds a single character 'A', 'E'



Strings: When declaring a string variable, you usually indicate its maximum length (1- 255). For example, to create a variable called City that can hold up to 25 characters, you would type: city: String[25]; If you do not include a maximum size, the string is given a default maximum size = 255.



Variable Ranges

Data Type Minimum Value Maximum Value

Integer -32,768 32,767

LongInt -2,147,483,648 2,147,487,647

ShortInt -128 128

Real 2.9 x 10 E-39 1.7 x 10 E+38



Rules for Identifier Names

All identifier names, including program names and variable names must follow the following rules:

Must begin with a letter or underscore (_)

Can only contain letters, numbers, or underscore (_)

Cannot contain any blank spaces

Examples of Illegal Identifiers: 2Length, AB*3, Len gth.



Operator Precedence

The following precedence table applies to Real and Integer operators. Parentheses always have the highest priority, and operators of equal priority are always performed left to right.



Priority Operation

First * / DIV MOD

Second + -





For example: To evaluate 4.0 + 6.0 * 3.0, you must follow the precedence table and perform the multiplication first, and the addition second. Hence, evaluating this expression will always give an answer of 22.0. If you want to perform the addition first, you must include the 4.0 + 6.0 within parentheses: (4.0 + 6.0) * 3.0.



Integer Division

7 / 3 = 2.3333, but 2.3333 is not an Integer. Hence, we need a method of doing division that only results in Integer values. For this we use MOD and DIV:







2 <---- Use DIV to get this result: 7 DIV 3 = 2.

_________

3 | 7

6

____

1 Remainder 1 <--- Use MOD to get this result:

7 MOD 3 = 1



Mixed Mode

If you use integers and reals together, integers are automatically converted to reals. For example, if you have the following expression:



Profit := (3.0 * 4.0)/2

the 2 is automatically converted to 2.0 and the result is equal to 6.0.
?
2016-10-25 14:40:28 UTC
commence with a 2 dimensional array. each row is one subscript ([a million..even with]) each column is yet another (['a million..even with]). Make it both integers or files. convinced i understand, for snakes and ladders some forums have alternating instructions for squares contained in the rows. yet you do not ought to literalize it. commence over each row on the bottom column and in basic terms coach it on the reveal screen as reversed.
ashish a
2009-03-03 17:38:38 UTC
integer,floating point numbers(decimal numbers),character,boolean(true or false).I'm not sure if string is also there.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...