My simple C and chess learning continues as I try to print a chessboard on the console. I look forward for helpful replies, but not necessarily a complete solution. Thanks.
In your example, there was only 2 ranklines, while I tried to write a loop to do it throughout the board. But it failed for some reason, so I wonder if you know how to do it (I'm only amateur with programming, and also limited skill).
I was very serious when I said break this up into small functions that do one thing.
Missing ranklines between rows? Simply add a call to printline where needed.
1 2 3 4 5 6 7 8 9 10 11 12
void print_row (int r)
{ int c, n;
printf ("%d ", r);
for (c=7; c>=0; c--)
{ n = c * 8 + r;
printf ("| %02d ",n);
}
printf ("| ");
print_rank (r);
printline ();
}