+ 2
What is the difference between variable initialization and variable definition?
1 Odpowiedź
+ 7
Definition means where you define the variable that you will be using in your code
For example : int a;
//Here you defined the variable a, it means it will reserve a empty memory space for future values.
Initialization means assigning a value to variable.
For example : a = 10;
//Here we assigned value of 10 to the variable be already defined
-> note : you can also do definition and initialization at a time
For example : int a = 10;