C language
-
Loop control statement
-
Goto statement
-
Unconditional turn statements
-
Goto generally forms a circular structure with if statements
-
int a = 1, sum = 0; tiao: if (a <= 200) { sum = sum + a; a++; goto tiao; } printf("%d", sum);
-
Goto — cannot be used across functions
-
Jumping from inside the circulatory system to outside the circulatory system will destroy the principles of structured programming
-
-
Statement while
-
While: judge first and then execute. When the type of loop structure
-
int a = 1, sum = 0; while (a <= 200) { sum = sum + a; a++; } printf("%d", sum); //The effect is the same as goto statement
-
、
-
-
Do while statement
-
Until the loop statement, – do while
-
int a = 1, sum = 0; do { sum = sum + a; a++; } while (a <= 200); printf("%d", sum);
-
Execute first and then judge
-