Study Notes (04): C # fast entry - the concept of variable declarations and assignments

Learning immediately: https://edu.csdn.net/course/play/20589/257716?utm_source=blogtoedu

Variables: a data memory for storing computer

 

Declare variables: declare variables that apply to the system memory, you need to specify the name and type of the variable declaration syntax is as follows:

[Variable Type] [Variable Name];

For example: int age; // declare integer type a name for the age of (int) variable.

 

Assignment of variables: variables "=" assignment

Form: variable name = value

It said it would assign a value to a variable right-hand side of the equal sign on the left

For example: int number; // represents an integer type opened up room in memory, and named number.

           number = 50; // the number 50 in this integer into.

 

Easier way: variable type variable name = value; // declare a variable represents, while the value assigned to the variable.

For example: string name = "xxx"; /// string type declaration of a variable name, and assigned to "xxx"

 

Variable use: you must be declared (defined) by assignment and finally use , the use of variables in the absence of an assignment, the system will error.

 

Note: Variable not allowed to repeat the amount declared (defined), but may be repeated assignment. After assigning a new value before the value is gone, replaced by a new value to.

Released five original articles · won praise 0 · views 20000 +

Guess you like

Origin blog.csdn.net/zimoidieying/article/details/105163349