双休息 [英] Double break

查看:55
本文介绍了双休息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello group。


是否有任何有效的方法可以在不使用跳跃的情况下双击''打破''二维循环

变量或中等i和j?


例如


for(i = 0; i< x; i ++)

for(j = 0; j< y; j ++){

z;

break(2); / *我知道2没有帮助* /

}

解决方案

在comp.lang.ci中读取:

是否有任何有效的方法可以在没有使用跳跃,额外变量或中和i和j的情况下双重''打破''二维循环




nope。


-

a签名


< blockquote>文章< IQ ******************* @ news2.e.nsc.no>,

Martin Johansen< mf * *@online.no>写道:

有没有任何有效的方法来加倍''打破''二维循环
而不使用跳跃,额外的变量或中和i和j?




你为什么关心,因为你可以使用goto?


- Richard


Martin Johansen写道:

你好组。

是否有任何有效的方法来加倍''打破''二维循环
不使用跳跃,额外的变量或者中和i和j?

对于(i = 0; i< x; i ++)
for(j = 0; j< y; j ++){
z;
break(2); / *我知道2没有帮助* /
}




K& R建议在3.8节中使用goto。他们说这是唯一的

时间可以使用goto。


-Trevor


Hello group.

Are there any efficient way to double ''break'' a 2-dimensional loop
without using a jump, an extra variable or midifying i and j?

e.g.

for(i = 0; i < x; i++)
for(j = 0; j < y; j++){
z;
break(2); /* i know the 2 does not help */
}

解决方案

in comp.lang.c i read:

Are there any efficient way to double ''break'' a 2-dimensional loop
without using a jump, an extra variable or midifying i and j?



nope.

--
a signature


In article <IQ*******************@news2.e.nsc.no>,
Martin Johansen <mf**@online.no> wrote:

Are there any efficient way to double ''break'' a 2-dimensional loop
without using a jump, an extra variable or midifying i and j?



Why do you care, since you can use a goto?

-- Richard


Martin Johansen wrote:

Hello group.

Are there any efficient way to double ''break'' a 2-dimensional loop
without using a jump, an extra variable or midifying i and j?

e.g.

for(i = 0; i < x; i++)
for(j = 0; j < y; j++){
z;
break(2); /* i know the 2 does not help */
}



K&R suggests using goto in section 3.8 . They say it is about the only
time it is okay to use goto.

-Trevor


这篇关于双休息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆