码迷,mamicode.com
首页 > 其他好文 > 详细

break和continue

时间:2015-02-22 20:45:45      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:

/*
 ============================================================================
 Name        : TestVariable.c
 Author      : lf
 Version     :
 Copyright   : Your copyright notice
 Description : break和continue
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void) {
	testBreakAndContinue();
	return EXIT_SUCCESS;
}

void testBreakAndContinue() {
	int i;
	for (i = 0; i < 10; i++) {
		if (i == 5) {
			break;
		}
		printf("i=%d\n", i);
	}

	printf("================\n");

	int j;
	for (j = 0; j < 10; j++) {
		if (j == 5) {
			continue;
		}
		printf("j=%d\n", j);
	}
}

break和continue

标签:

原文地址:http://blog.csdn.net/lfdfhl/article/details/43908587

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!