Today review the C language type conversion and branching structure, C is a strong data type, and his grammar compiler is not as strict as other languages later, so we must pay attention to our own data type when using it. Type conversions are divided into: Forced type conversions and automatic conversions. The so-called forced catch is the process of artificially adding the data type that you want to convert before the result, for example: int a= (int) (1.000), which is 1.00 will be cast to 1. The so-called automatic conversion is the automatic conversion of the program. For example: "=" the so-called assignment number is a potential automatic conversion. For example: int a=1.0; When we use printf () to output it, the result is 1. Because a has converted 1.0 to 1 when it is given a value. The principle that auto-conversions follow is a small range of data type conversions to a large range of data types.
Two: Branch structure: Branch structure includes single branch and multi-branch, single branch is if and Else branch is switch;
Three: Circular structure: The loop structure can be expressed in three ways: for (), while, Do-while ()
For syntax:
for (int i=0;i<10;i++) {
}
while (judging condition) {
}-----------------First judge and then execute the
do{
}--------------Features: First execute once and then judge
while (judging condition)
C Language Learning Four