Home >Backend Development >C#.Net Tutorial >What is the difference between declaration and definition in C#?
Declaration means only declaring the variable and allocating memory, but not setting any value.
But definition means that the variable has been initialized.
The same is true for variables, arrays, collections, etc.
Declare variables.
int x;
Let's define and assign a value.
x = 10;
Declare an array.
int [] n // declaring int n= new int[10]; // initializing
Let's assign a value.
n[0] = 100; n[1] = 200
The above is the detailed content of What is the difference between declaration and definition in C#?. For more information, please follow other related articles on the PHP Chinese website!