C警告:声明不起作用 [英] C Warning: Statement with no effect

查看:157
本文介绍了C警告:声明不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



  gcc -pedantic -Wall -ansi 

我收到警告:警告:没有效果的语句

引用此行:

pre $ for(currentDirection; currentDirection< = endDirection; currentDirection ++)

任何人都可以帮我解决这个问题吗?解决方案

b

  for(; currentDirection< = endDirection; currentDirection ++)

或者,如果您忘记初始化变量:

$ p $ for(currentDirection = 0; currentDirection < = endDirection; currentDirection ++)


When trying to compile my prgram with:

gcc -pedantic -Wall -ansi 

I get the warning: warning: statement with no effect

Referring to this line:

for(currentDirection; currentDirection <= endDirection; currentDirection++)

Can anyone help me with this?

解决方案

currentDirection; does nothing.

Replace your line with

for(; currentDirection <= endDirection; currentDirection++)

Or, in case you just forgot to initialize the variable:

for(currentDirection = 0; currentDirection <= endDirection; currentDirection++)

这篇关于C警告:声明不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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