Variable Declaration Encyclopedia Article

Variable Declaration

The following sections of this BookRags Literature Study Guide is offprint from Gale's For Students Series: Presenting Analysis, Context, and Criticism on Commonly Studied Works: Introduction, Author Biography, Plot Summary, Characters, Themes, Style, Historical Context, Critical Overview, Criticism and Critical Essays, Media Adaptations, Topics for Further Study, Compare & Contrast, What Do I Read Next?, For Further Study, and Sources.

(c)1998-2002; (c)2002 by Gale. Gale is an imprint of The Gale Group, Inc., a division of Thomson Learning, Inc. Gale and Design and Thomson Learning are trademarks used herein under license.

The following sections, if they exist, are offprint from Beacham's Encyclopedia of Popular Fiction: "Social Concerns", "Thematic Overview", "Techniques", "Literary Precedents", "Key Questions", "Related Titles", "Adaptations", "Related Web Sites". (c)1994-2005, by Walton Beacham.

The following sections, if they exist, are offprint from Beacham's Guide to Literature for Young Adults: "About the Author", "Overview", "Setting", "Literary Qualities", "Social Sensitivity", "Topics for Discussion", "Ideas for Reports and Papers". (c)1994-2005, by Walton Beacham.

All other sections in this Literature Study Guide are owned and copyrighted by BookRags, Inc.

Variable Declaration

Variable declaration refers to the need to declare a variable before the variable can be used in a program. The declaration of variables is made via a variable declaration statement.

Variable declaration is a means of notifying the compiler—a program that translates source code into object code--about the existence and nature of a variable. Items of concern would include the type of variable, the variable name and information about the memory that has been allocated for the variable. A variable declaration tells the compiler to allocate enough memory to hold a value of this data type, and to associate the identified memory with the location.

The subsequent allocation of storage for the variable by the compiler represents another process often termed as variable definition. Although declaration and definition often occur almost simultaneously and cannot be distinguished, they are different functions. A variable declaration begins with "var." Then it declares a variable identifier whose type can be specified by a type identifier or a type definition. Various types of definitions are possible, including an array, a record, a set and a subrange. One example of a variable declaration would read as:

or a similar statement, except that the command phrase "type definition" is substituted for "type identifier."

Following its declaration, a variable is available for use in a program.