Break out of for loop - C Statement

C examples for Statement:break

Introduction

When the break statement is encountered inside a loop, the loop is immediately terminated

The program control resumes at the next statement following the loop. For example,

Demo Code

#include <stdio.h>

int main(void)
{
   int t;//from www  . java2s .com

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

   return 0;
}

Result


Related Tutorials