for (int a = 0, int x = 1; a < 2; a++, x++)
{
// Body
}
When I do this, it shows me an error on that line at the part when I declare x.
The error is:
error: expected identifier or '('
for (int a = 0, int x = 1; a < 2 && x < 3; a++, x++)
Please note that this was the first time I ever declared x
.
This problem is related to cs50's filter.
I tried googling to see if the code itself was incorrect but all the example were like mine.
I tried replacing the ,
with ;
but that just made another error saying it was expecting an expression at the very same place.
I also tried remove the int
from x
and declaring it at the start of the function but that also was an error saying it was shadowing a local variable.