for while 要求选慢速的,但是for不卡,while 跟 递归 这两个容易卡

for比while慢,但是for不卡,while跟递归容易卡

int index = 0;

bool jump=flase;

for( index;index==0;;)/*这个空分号算一个语句*/

{

if(找到数据)

{

jump = true;

}

if(jump == true)

{

//按逻辑是否 需要将jump的布尔标记设置为初始false状态

goto outFor://无条件跳转到 outFor后向下一条运行之后的代码

}

 

}

outFor:

 

posted on 2024-05-27 12:22  草丛有头猪  阅读(3)  评论(0编辑  收藏  举报

导航