Mega Code Archive
Categories
/
C
/
Code Snippets
Use break in for loop to exit
#include
int main(void) { int x; for(x = 1; x < 100; x++) { printf("%d ", x); if(x == 10) break; /* exit the for loop */ } return 0; }