How to define variables in C#?

CsharpProgrammingServer Side Programming

Each variable in C# has a specific type, which determines the size and layout of the variable's memory the range of values that can be stored within that memory and the set of operations that can be applied to the variable.

For variables −

<data_type> <variable_list>;

Let us see an example −

int x, y;

Above the variable is of int type. Let us declare a variable for other types.

Variable of float type −

float z;

Variable of short type −

short p;
Updated on 30-Jul-2019 22:30:23