2) What are variables. ? Explain difference between
initialization and declaration of variable.
Answers
Answered by
1
Declaring a variable reserves a name and some space in memory for a variable of the specified type, but doesn't give it a value. Initializing gives the variable a value. Depending on how you're going to use the variable, you can declare it without initializing it and then initialize it later, or declare and initialize at the same time. For example:
int value1; // declares integer variable
value1 = 6; // initializes integer variable that's already been declared
int value2 = 5; // declares and initializes integer variable
Similar questions