Computer Science, asked by anitha85, 11 months ago

what is variable? how do u declare a variable?

Answers

Answered by ankit6316
1

Answer:

A variable is a way of naming and storing a value for later use by the program, such as data from a sensor or an intermediate value used in a calculation.

Declaring Variables

Before they are used, all variables have to be declared. Declaring a variable means defining its type, and optionally, setting an initial value (initializing the variable). Variables do not have to be initialized (assigned a value) when they are declared, but it is often useful.

int inputVariable1;

int inputVariable2 = 0; // both are correct

Programmers should consider the size of the numbers they wish to store in choosing variable types. Variables will roll over when the value stored exceeds the space assigned to store it.

Similar questions