Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C Warning: Statement with no effect

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?

like image 862
aytee17 Avatar asked Mar 24 '11 09:03

aytee17


1 Answers

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++)
like image 134
ThiefMaster Avatar answered Sep 16 '22 12:09

ThiefMaster