0 votes
in Dot Net by
What is variable and constant in .NET programming language?

1 Answer

0 votes
by
Variable: A variable is a data storage location in the computer memory that contains a value and has a meaningful name. Every variable is attached to a data type which determines what type of value can be stored in the variable.

Variables can be declared by using the following syntax:

<data_type>  <variable_name>;  

Constant: Constant is also similar to the variable except that the value. Value once assigned to a constant can't be changed. Constants must be initialized at the same time they are declared.

Constants can be declared by using the following syntax:

const int interestRate =10;
...