Chinaunix首页 | 论坛 | 博客
  • 博客访问: 432454
  • 博文数量: 138
  • 博客积分: 4114
  • 博客等级: 上校
  • 技术积分: 1341
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-14 20:41
文章分类

全部博文(138)

文章存档

2014年(1)

2013年(2)

2012年(78)

2011年(13)

2010年(34)

2009年(10)

我的朋友

分类: C/C++

2009-09-24 11:14:53

how to out the multi-cycle in C
we all know the key-word break;
but it can only out one cycle, if we want to out multi-cycle, how we do ?

method 1:
  use goto
method 2:
  use a variable to store the state, if the state can meet, then we break; else we not, just like this
  int whether_out = 0;
  .......
  {
     whether_out = 1;
  }
  if (whether_out = 1)
          break;
method 3:
   we all know that when we do loop, we will determin
the cycle-conditions, we in the inner cycle, we can change the cycle-conditions to break out the cycle.
it like this
  for (i = 0; i < max_i; i++)
{
   for( j = 0; j < max_j; j++)
   {
     .......
     ........
     i = max_i;
   }
}



阅读(444) | 评论(0) | 转发(0) |
0

上一篇:LFS 学习

下一篇:set the enviromnet variable

给主人留下些什么吧!~~