gpt4 book ai didi

c - 带有两个 IF 语句的 While 循环

转载 作者:太空宇宙 更新时间:2023-11-04 05:13:16 24 4
gpt4 key购买 nike

我有一个使用 while 循环读取文件的脚本。一个 IF 语句读取该行(它是一个 csv 文件),然后第二个语句检查是否匹配。

while ( file != NULL )
{
if ( sscanf to read the line )
{
if ( to check for matches)
{
toggle variable
break;
}
}
}

如果我将 break 添加到第二个 IF 语句(如上所述)中,是否会跳出 两个 IF 语句和 WHILE 循环?还是我需要额外的 break; 才能跳出 while 循环?

最佳答案

breakcontinue 语句用于最近的循环。甚至不考虑 if 语句。

switch 语句中的 break 当然是个异常(exception)。

关于c - 带有两个 IF 语句的 While 循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22089353/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com