for loop - statement with no effect
For some reason I'm getting an 开发者_运维问答error: statement with no effect
on this statement.
for (j = idx; j < iter; j + increment) {
printf("from loop idx = %i", (int)idx);
punc(ctxt, j);
}
You probably meant to write j += increment
instead of j + increment
.
I think you meant j += increment
, as j + increment
doesn't actually alter j
or indeed have any side effects at all - it is a statement with no effect, which is what the compiler is telling you
Replace
j + increment
With
j += increment
You are getting that as an error? How cool, I wish my compiler did that. Basically j + increment
will return the sum of those two, but j
won't get modified so your loop would probably run forever.
It's clear you meant +=, but in the case that isn't true, the 'volatile' qualifier should prevent warnings.
精彩评论