[WEBINAR] Embedded Analytics for Today's Information Workers


Definition - What does Variable mean?

A variable, in the context of programming, is a symbolic name given to an unknown quantity that permits the name to be used independent of the information it represents. Variables are associated with data storage locations, and values of a variable are normally changed during the course of program execution. Variables represent all kinds of data, including booleans, names, integers, arrays, pictures, sounds, scalars, strings, or any object or class of objects depending on the programming language that supports them. The symbolic names of variables are replaced with the actual data location by compilers and interpreters. Data in locations changes during execution while locations and names are fixed.

Techopedia explains Variable

A variable is assigned a value in one place and then used repetitively. Variables generally have four attributes: an identifier, data location, type and value. They are assigned during program execution at different times. In a few instances, non-identical identifiers may refer to the same location, variable, and value. Variable types specify the kind of information stored in a variable. They also describe the format of the value stored, memory occupied, and methods for manipulating and expressing the content.

Programming variables are normally represented using multiple-character names. Single-character names are normally used to represent auxiliary variables (for example, a loop variable might be named i). Naming of variables is supported at different language levels and is part of the language syntax. Most languages allow an underscore in variable names.

Programmers follow code style guidelines to name variables. Short names are less descriptive but easy to type, whereas long names can specify the purpose of a variable in the program. For example, the syntax int temp=0; in JAVA or C++, "temp" is the variable name; the type of variable is integer and its value is 0.

The scope of a variable determines the use of a variable in a program. A variable’s scope is the part of the program code in which the variable is visible and has a meaning. Memory space is allocated to a variable when the variable is first used and deallocated when it is no longer needed. If variables are declared and not used, compilers normally issue a warning.

This definition was written in the context of Programming
Share this: