c - else if 语句错误,我如何转到嵌套 for 循环中的下一个语句

标签 c

for(;;){ /********* infinite iteration**************/
  for(k=1;k<=8;k++){
                  loop1:
                     for(n=0; n<48;n++){
                        for(i=0; i<8; i++){
                               for(j=0; j<natm; j++){
                                             ...................
                                                statements;
                               }
                        }

                    }   
                  E[iter] /*** Result of three loops such as n,i,j ***/ 

                  if (E[iter] < E[iter-1])  
                  {
                    iter++;
                    print the value of E[iter];
                    /***again calculate the E[iter] ****/
                    goto loop1;
                  }
                  else if(E[iter]>E[iter-1])
                 {
/**   stop the current for loop of k and move to k=2 **/
     /*** here is the problem for me i want to get rid of this loop and goto to the next iteration for loop (k =2)***/  

                 }  

            }
      }

最佳答案

替换您的评论/*这就是问题所在...... 与

continue;

Continue 语句将跳过当前迭代并继续进行下一次迭代,而不会像 Break 那样中断整个循环;声明。

关于c - else if 语句错误,我如何转到嵌套 for 循环中的下一个语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15783619/

相关文章:

ios - Xcode LLDB 断点条件 - 我可以在 C 函数值上中断吗?

c - 什么时候在函数指针中使用 "&"运算符?

c - 为什么要在这个程序中使用 fflush(stdin)?

c - 将 char 和 int 与 concat 混合

c - 使用工具链对 strcmp 的 undefined reference

比较 float

c - 如何仅当变量更改为特定值时使 if 条件为 true

c++ - 理解一点代码

c - GTk 每个小部件加速器

我可以将 scanf 与指针一起使用吗?