Variable Declaration in C#
Syntax for variable declaration in C# is:
;
Here, data_type must be a valid C# data type including char, int, float, double, or any user defined data type etc., and variable_list may consist of one or more identifier names separated by commas.
Some valid variable declarations along with their definition are shown here:
int i, j, k; char c, ch; float f, salary; double d;
You can initialize a variable at the time of declaration as:
int i = 100;
No comments:
Post a Comment