Another Noob Question - My code is not working as i expect it to.
In the following code (userAns[0] - userAns[5] all = 1) and (userAns[6] - userAns[9] all = 0)
When run i would expect the 0-5 values to return a correct message and the 6-9 values to return wrong, but all values return the question is wrong text?
The program does run but not correctly and i just noticed that the line " if (userAns[i] == 1) " gets a Nonportable pointer conversion error.
Being a total noob looking at the code i wrote i dont understand why when userAns[i] has a value of 1 that it does not display question correct.
What am i doing wrong?
Code:
//FUNCTION TO DISPLAY WRONG OR CORRECT
int score (void)
{
int i, correct;
correct = 0;
clrscr();
for (i=0; i<=q; i++)
{
printf ("\n%s", userAns[i]);
if (userAns[i] == 1)
{
correct++;
printf("\n%s\nYou got this question correct", mystr[i]);
}
else {
printf("\n%s\nYou got this question wrong", mystr[i]);
}
}
return;
}