Possible Duplicate:
lvalue required as left operand of assignment
lvalue required as left operand of assignment (C program)
I am getting this error on my code and I am not sure why. Please help! The error is:
error: expected primary-expression before ‘=’ token
This is the part of my code i'm having the issue with. a and b were already previously declared as ints.
int i = 0;
for( i == a; i < = b; i = i + 1) // ERROR IS IN THIS LINE
{ int j = 1;
int N = static_cast<int>(sqrt(i));
for( j = 1; j < = N; j = j + 1) // ERROR IS IN THIS LINE
{ int P = i%j;
if( P == 0 && j!= 1 && j!= i)
{ j = N + 1;
}
if( P != 0 && j == N)
{ cout << i << "is prime" << endl;
}
}
}