警告:建议用作真值赋值左右括号[

编程入门 行业动态 更新时间:2024-10-26 12:31:13
本文介绍了警告:建议用作真值赋值左右括号[-Wparentheses]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述
  • 节目片段是为素数提取写的。
  • 该警告是由编译器作为之类的标题抛出。

  • The program snippet was written for prime number extraction.
  • The warning was thrown by the compiler as that like the title. while(count<=n) { for(c=2;c=(i-1);c++) //the warning is shown here { if(i%c==0) break; } if(c==i) { printf("%d ",i); count++; } i++; }

  • 感谢你提前!

    推荐答案

    的如果语句的中间前pression通常是有条件的,如 I&LT; ñ。你的情况,这是一个任务。

    The middle expression of an if statement is usually a conditional such as i < n. In your case, it is an assignment.

    编译器警告你,或许你犯了一个错误,你想用

    The compiler is warning you that perhaps you made a mistake and you meant to use

    c == (i-1)

    而不是

    c = (i-1)

    更多推荐

    警告:建议用作真值赋值左右括号[

    本文发布于:2023-07-31 15:46:03,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1260056.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:真值   赋值   括号   建议

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!