Symbol or name for a value. For example, in the expression
x + y
x and y are variables. Variables can represent numeric values, characters, character strings, or memory addresses.
Variables play an important role in computer programming, as they allow programmers to write flexible programs. Instead of entering data directly into the program, the programmer can use variables to represent the data. Then, when the program is executed, the variables are replaced with real data. This allows the same program to process different data sets.
Each variable has a name called a variable name and a data type. A variable data type indicates which value represents the value of a variable, for example, whether it is an integer, a floating-point number, or a character.
user1999948
source share