The problem is this line:
if (x % 10 = 0)
That should be the double-equals sign:
if (x % 10 == 0)
A common typo.
Question
I'm trying to print out an array of 100 lf values into columns of ten. I was planning on inserting a new line whenever I hit the tenth data value in each line, but I'm having trouble with my if statement. "Left operand must be 1-value" is the error I keep running into. Here's the code as is:
for (x=0; x<100; x++)
{
if (x % 10 = 0)
{
printf("\n");
}
printf("|%-6.2lf|", i[x]);
}
Is there a cleaner way to do this?
No correct solution
OTHER TIPS
The problem is this line:
if (x % 10 = 0)
That should be the double-equals sign:
if (x % 10 == 0)
A common typo.