#THIN C vs.THINK C
I have been "learning" C for a while. I started by purchasing the Dave Mark
book "Learn C on the Mac" which includes THIN C. All's well with the examples
in the book. BTW, if anyone asks you about THIN C, be sure to tell them that
you must have 32-bit addressing OFF for THIN C to run.
Now then, I just got THINK C 6.0 and decided that a good learning tool (in
addition to the THINK C tutorial examples) would be to convert the THIN C
examples to THINK C. So I started to do just that. In each case, one must
change from "ansi.lib" (THIN C version) to "ansi" (THINK C version). No big
deal. The first several examples in Mark's book ran just fine in THINK C.
Then I got to "isOdd." I cannot get this beast to run in the THINK C
environment. I get an error message "wrong number of arguments for the function
'printf'" (in Line 10) every time I try to compile.
The code is:
main()
{
int i;
for ( i = 1; i <= 20; i++ )
{
printf( "The number %d is ", i );
if ( (i / 2) * 2 == i )
printf( "even" ); <—–ERROR HERE!!!
else
printf( "odd" );
if ( (i / 3) * 3 == i )
printf( " and is a multiple of 3" );
printf( ".\n" );
}
}
in case you do not have THIN C.
Would appreciate a comment from someone more knowledgable than I. Why does this
code execute perfectly in THIN C but not so in THINK C?
Thanks!