I am getting this error message while trying to run follwing program "relational comparison result unused"
#include <stdio.h>
#include <cs50.h>
int main(void)
{
int i, j;
for(i = 0, j = 0; i < 10, j < 3; i , j )
{
printf("%i %i\n",i, j);
}
}
I am expecting a result 0 0, 1 1, 2 2
CodePudding user response:
After adding two conditions
It's not two conditions, you probably need i < 10 && j < 3
.
relational comparison result unused
As user3386109 mentioned, it's because the compiler discards the result of i < 10
caused by the comma, so you need to change it to i < 10 && j < 3
.
I am expecting a result 0 0, 1 1, 2 2
Actually, I'm getting this result, probably you should share the cs50.h
content.
0 0
1 1
2 2