Rules for variable declaration
Rules for variable declaration in C#
·
A variable name must begin
with a letter or underscore
·
Variables in C# are case
sensitive
·
They can be constructed with
digits and letters
·
No special symbols are
allowed other than underscores
·
Variable name cant be a C#
keyword
Example
Variable name are : sum, Height,
_value, and abc123, etc. are some examples of the variable name
How to declare a variable in C#?
The Syntax for declaring a
variable in C# is as follows:
Syntax:
data_type variable_name;
Here, data_type is the type
of data to be stored in the variable, and variable_name is the name given to
that variable
Comments
Post a Comment