Computer Science, asked by Rinaax5384, 1 year ago

Difference between variable declaration and variable initialisation

Answers

Answered by grapher
2
HIIII

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.

EXAMPLE : int value1; // declares integer variable value1 = 6; // initializes integer variable that's already been declared int value2 = 5; // declares and initializes integer variable

HOPE IT HELPS



Similar questions