answersLogoWhite

0


Best Answer

A "declaration" in computer programming is when you define the properties of variables or functions used in the program. Most programming languages require you to "declare" the variables to be used within the program before they are used in any calculations or other operations. For example, in the C program language, you could define a variable like this: float distance; this declares a variable called "distance" and says that it is a "floating point" variable, that is, a numeric value, with optional decimal places. If we declare two other variables, and give them the names "speed" and "time", we can then use them within the main program, like this: distance = speed * time; (where the "*" is used in C and most other languages to mean multiply). You are free to use abbreviations for the variables, declaring them like this: float D, S, T; and then writing the expression above as: D = S * T; but it is considered "good programming practice" to use longer, "meaningful" names, especially in longer programs, where it would make the programs easier to read, and it would make it easier to remember what the variable names stood for. As well as "float" types (which may be called "real" or "double" in other programming languages), there are also some other types: For example, "int" types (sometimes written as "integer" in other languages) are for declaring a variable to hold a whole number, one without any decimal places. An example of this might be the declarations: int goalsfor, goalsagainst, goaldiff; int points; int won, drawn, lost; which could be used in the expressions: goaldiff = goalsfor - goalsgainst; points = won * 3 + drawn; The reason for declaring the variables as "int" rather than "float" is because, logically, you can't score 1.5 or 2.736 goals, and also, because variables declared as "int" can be stored using less computer memory. Another declaration type might be a "string" or "character" type, used to store text, that is, any mixture of letters and numbers, such as names, addresses, words - anything other than numeric values. In some languages, when you declare such a text variable, you also have to say how many letters are to be allowed. For example, in C, the declarations: char firstname[12], secondname[20]; char address[50]; allows 12 letters for the firstname, 20 for the secondname, and 50 letters/and or numbers for the address. Most computer languages will give an error if you make a mistake in a declaration, or if you forget to declare the variable - this can stop you from making mistakes later. For example if you had the declaration: int numchildren, sons, daughters; and then used the expression: children = sons + duaghters; the computer would show two errors - one because you declared the variable as "numchildren", but used "children" in the expression, and secondly because you mis-spelled "daughters". As stated above, this can also apply to functions (also known as "procedures" or "subroutines"), but this a slightly more complicated topic which could be the subject of another question.

User Avatar

Wiki User

16y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

Declaration is where you indicate what variables are used in the unit or function/procedure.

For example, in some languages you can make up variables as you go, like the following C# example:

static void Main(string[] args)

{

string firstName = "John";

string lastName = "Doe";

}

Pascal and Delphii are strongly typed languages.

You would create the same example in pascal as

Procedure Main;

var

FirstName: string;

LastName: string;

begin

FirstName := 'John';

LastName := 'Doe';

end;

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

A declaration in assembler is simply a declaration of a named variable or constant. The symbolic names are stripped out during assembly, to be replaced with the actual memory address assigned to those variables. They simply make it easier to reference memory even when you cannot know the actual addresses in advance of assembly.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is declaration in pascal programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Code for creating pascal's triangle in C programming language?

code for creating pascal's triangle in C programming language?


Is PASCAL a programming language?

Yes


What is the best programming language to use for DVD cataloguing out of Pascal Fortran and LISP?

Pascal. Of the three, it is better suited to database programming.


What is a sentence for pascal?

Pascal is a very interesting language to learn. Pascal is actually a computer programming language.


In programming data read by programming is called?

Pascal language is used to read the programming data.


What is the full form of PASCAL?

PASCAL has 3 definitions actually. They are:- 1. Programming Language Based For Blaise Pascal. 2. Pedantry and Strictness Created A Language. 3. Philips Automatic Source Calculator.


Who developed pascal programming?

The original Pascal programming language was designed by Niklaus Wirth between 1968 and 1969, published in 1970. Object Pascal was developed in 1985 by Larry Tessler, in consultation with Wirth.


What is purpose of pascal?

The Pascal language is used just like any other programming language. In the 70's and 80's, Pascal and Basic were the most common languages taught for beginning programming classes. Pascal is the foundation of the popular Delphi programming language as well as part of the Oxygene language for .NET. Pascal language is easier to read and is not case sensitive, which can add to difficulty in learning programming. It's also easier to debug.


What is the full name of Pascal in programming?

it doesn't really have a full name. It's just as it is " PASCAL"


Who invented Pascal?

The computer programming language known as Pascal was invented by Niklaus Wirth in 1970.


What kind of written language did Delphi use?

Delphi used a programming language called Object Pascal for its written language. Object Pascal is an extension of the Pascal language that includes object-oriented programming features.


Why was turbo pascal programming named after the french mathematician blaise pascal?

Pascal programming was invented by Niklaus E. Wirth, a Swiss computer scientist in 1968. It was named in honour of Blaise Pascal (1623-1662) because he invented the first automatic adding machine.