Use break to terminate a for loop : For Break « Language Basics « C / ANSI-C






Use break to terminate a for loop


#include <stdio.h>

int main(void)
{
  int t;

  for(t = 0; t < 100; t++) {
     printf("%d ", t);
     if(t == 11) 
        break;
  }

  return 0;
}

  

           
       








Related examples in the same category

1.indefinite loop and break
2.Break a infinite loop
3.Use break in for loop to exit
4.Nested for loop and break