Lesson 4 - Data type variable (at)

1.C language naming rules

Character sequence of letters (az, AZ) numbers (0-9) or underscore (_) configuration -

- The first character must be a letter or an underscore (not digital)

- case-sensitive (such as: name and Name are two names)

  

 

 

2. Question: How to change the value of the variable represented?

Analogy:

- variables like life in the glass, then, as long as the situation does not overflow, variables can represent any value

- glass of wine may be increased or decreased at any time, the value of variable representation can be changed at any time

 

3. The program variable assignment

- Definition: The change represents a variable worthy of operation is called the assignment operator

- Example:

  

 

 

 

4. The variable initialization program

- Definition: while creating variable display specify an initial value

- Example:

  

 

 

Highlighted (focus)

- Assignment program (=) in the amount equal to not mathematics

- the initial value of the specified operation is called initialization of variables simultaneously creating (int i = 1;)

- Creating variable operation after changing its value is called the assignment (int i; i = 1;)

- no initialization of variables, which is a random value

- agreed saying: Create a variable "=====" defined variables

 

Programming Experiment: Initialization and assignment variables

 

3. Summary

- names must follow the rules, otherwise it will compile error

- You can change the value of their representatives after the definition of variables (assignment)

- definition of variables and can specify a value (initialization)

- initialization and the assignment of two distinct operations (although the same reference numerals)

- Assignment program (=) mathematics is completely different and equal

 

Guess you like

Origin www.cnblogs.com/hoiday/p/11484644.html
Recommended