Nested examples of break using a for loop

  • 2020-04-02 02:13:28
  • OfStack



# include <stdio.h>
int main(void)
{
    int i,j;
    for(i=0;i<3;++i)
    {
        for(j=2;j<5;++j)
        break; //The break statement can only terminate the closest loop to the statement
        printf(" I will be output 3 Time? ?n");
    }
}
/*
----------------------
 The code by C-Free 5.0  Write and output debugging results 
------------ The output -------------
  I will be output 3 Time? ?
 I will be output 3 Time? ?
 I will be output 3 Time? ?
---------------------------
 Conclusion: 
break Statement can only terminate the loop closest to it, so printf The output 3 Times.  
*/


Related articles: