M
Morris Keesan
18 char tab[16+1]; ....
24 memset(tab,'.',16); ....
34 if (column == 16) { ....
40 if (line == 16) { ....
52 while (column < 16) { ....
57 tab[16]=0;
I usually deduct points from students who use uncommented bare magic
numbers like this. Especially when the program is related to
base-16 (hexadecimal) output, and where the 16 in line 40 seems to be
unrelated to any of the other 16s. This might be a good time to
introduce the sizeof operator, and/or #defines. If they've already
been introduced, consider adding, as an exercise, "What would you need
to change to print a different number of characters per line?"
6: What would happen if you are working in a machine where the
characters are 16 bits wide? What needs to be changed in the
above program?
What about if you are working with a machine where the character width
is not a multiple of 4 bits?
(For many years, I worked with a Unix platform where the chars were
ten bits wide. Someone doing hardware design thought this was a good
idea.)