On both for loops (ie: for(len… and for(wid… ), I receive the same error message:
error: expected ‘;’ before ‘)’ token
void
init(void)
{
//fills board up with numbers
int tile = (d*d - 1);
int len = 0;
int wid = 0;
for(len < d; len++)
{
for(wid < d; wid++)
{
board[len][wid] = tile;
tile--;
}
}
}
Sorry to ask a similar question as before, but I’m a very confused Newbie!
Every for-loop needs to have its 3 parts (initialization, test, update) and if you don’t have one or more of them, you still have to supply the two
;, soshould really be
and the same for the other for-loop in your function.
For instance, this is how you would set up an infinite loop using
for:where all parts are skipped, but the two semi-colons are still required.
Perhaps this is tutorial/reference on the for-loop is helpful as a review/reference.