English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

what is your understanding of a variable in the terms of computer programming.

2006-12-18 10:38:27 · 3 answers · asked by g_playa_gent 1 in Computers & Internet Programming & Design

3 answers

A variable is a store space in memory which can store information that can dynamically (on the fly) change with either user input, or though hard coding (from the programmer's side).

2006-12-18 10:48:17 · answer #1 · answered by D 4 · 0 0

A variable is a word you use in a program so that you can easily identify a place in memory. For instance, if you're writing an accounting program you might have a variable for the interest rate, such as: intRate

The way you create a variable depends on the language. In some you have to identify the type of variable, the variable name, and the value. For instance, using the above example, you might have the following variable definition:
double intRate = .05;
The double part is the type of variable (a decimal-number), intRate is the variable, '=' means you're assigning the value .05 to the place in memory that your variable refers to.

The reason you need the variable type is because different types of variables are stored in different ways. Some take up more bytes in memory than others, and as a result you need to reserve more bytes/words for them.

Later in your program, you might change the interest rate. Since you've already defined it, you can simply do the following:
intRate = .15

2006-12-18 18:57:46 · answer #2 · answered by Anonymous · 0 0

a variable is a change-able parameter.

2006-12-18 18:45:57 · answer #3 · answered by General T 2 · 0 0

fedest.com, questions and answers