<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # C - `continue`語句 > 原文: [https://beginnersbook.com/2014/01/c-continue-statement/](https://beginnersbook.com/2014/01/c-continue-statement/) **`continue`語句**用于[循環](https://beginnersbook.com/2014/01/c-loops-examples/)。當在循環內遇到 `continue`語句時,控制流跳轉到循環的開頭以進行下一次迭代,跳過當前迭代循環體內語句的執行。 ## C - `continue`語句 語法: ```c continue; ``` ### `continue`語句的流程圖 ![C Continue Statement](https://img.kancloud.cn/5f/f0/5ff0abe92e9f78b98451df7d3022d000_400x400.jpg) ### 示例:`for`循環中的`continue`語句 ```c #include <stdio.h> int main() { for (int j=0; j<=8; j++) { if (j==4) { /* The continue statement is encountered when * the value of j is equal to 4. */ continue; } /* This print statement would not execute for the * loop iteration where j ==4 because in that case * this statement would be skipped. */ printf("%d ", j); } return 0; } ``` 輸出: ```c 0 1 2 3 5 6 7 8 ``` 輸出中缺少值 4,為什么?當變量`j`的值為 4 時,程序遇到一個`continue`語句,它使控制流跳轉到`for`循環的開頭以進行下一次迭代,跳過當前迭代的語句(這就是`printf`在`j`等于 4 時沒有執行的原因)。 ### 示例:在`while`循環中使用`continue` 在這個例子中,我們在`while`循環中使用`continue`。當使用`while`或`do-while`循環時,需要在`continue`上方放置一個遞增或遞減語句,以便在下一次迭代時更改計數器值。例如,如果我們不在`if`的正文中放置語句,那么`counter`的值將無限期地保持為 7。 ```c #include <stdio.h> int main() { int counter=10; while (counter >=0) { if (counter==7) { counter--; continue; } printf("%d ?", counter); counter--; } return 0; } ``` 輸出: ```c 10 9 8 6 5 4 3 2 1 0 ``` 當計數器值為 7 時,將跳過`print`語句。 ### `do-While`循環的`continue`的另一個例子 ```c #include <stdio.h> int main() { int j=0; do { if (j==7) { j++; continue; } printf("%d ", j); j++; }while(j<10); return 0; } ``` 輸出: ```c 0 1 2 3 4 5 6 8 9 ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看