Quote:
|
Originally Posted by AlphaOmega870
for ( n = 1; n =< 150; n++; )
this line of code?
I continuosly get a syntax error with this line and can find no problem with it. Thank you in advance.
|
Err ... aside from the mentioned extra semicolon at the end, unless my memory has become severly skewed, I do believe you mean "<=" for less than or equal to, as opposed to "=<". But why such wird code? I mean, really, who starts counting at 1? (Besides normal people, of course
Traditionally, though, you'd say
Code:
for (n=0; n < 150; n++)
This is because C starts indexing at 0, like most sane languages. You can also avoid having an equal sign in the for loop. I suppose it is a matter of taste, though ... (and what you do with n within the loop)