Hello
I've made a code to check whether or not a save file has been created correctly, but for some reason it always returns this line: readdata[qa]=='1' as true. in which qa is the counter I use in a for loop and readdata is a character array consisting of 50 characters that are either 0, 1 or 2.
this is the entire code:
if ((readdata[qa]=='1')); //←Look here
{
oneCounter++;
if (oneCounter > 1)
return 0;
}
It is equivalent to
1 2 3 4 5 6 7 8
if ((readdata[qa]=='1'))
/*Do nothing*/;
{ //Useless brackets
//Following will be executed unconditionally
oneCounter++;
if (oneCounter > 1)
return 0;
}
Turn on compiler warnings. There is literally no compiler which wont warn about empty body of loop/conditional statement.
yes, thank you all, I just figgured out the same thing, but still thanks!
I love how fast people respond to things on this site!
(the savefile contains a 1 and then 49 0's if all is right)