I am reading a data set where each data line contains a value that I want to read over and then ignore.
So, I create three variables as:
int number1, number3;
float number2;
and read them in. I use the data in number1 and number3, but never use number2 (other than to be able to skip over it).
When I compile the program I get a warning that states that the number2 variable is set but not used.
This, of course, is not a problem in that my code compiles and runs just fine. But, in the spirit of cleaning up my code to eliminate warnings, what is the best practice for doing so in this situation?
I suppose I could add a line that states number2+=0; That would make the warning go away, and would not actually change the value of number2 in case I want to use it latter. But it adds an unnecessary calculation. So, while that eliminates the warning, it also does not seem like the best way to do it.
Is there a better suggestion?