Bug in C debugging puzzle

utzoo!decvax!ittvax!tpdcvax!bobvan utzoo!decvax!ittvax!tpdcvax!bobvan
Fri Nov 5 17:14:30 AEST 1982


Many thanks to Alan Watt who pointed out a clerical error in the
C debugging puzzle I recently posted.  The fragment in error should
have read:

	for (ip = &array2d[0][0]; ip < &array2d[XDIM][YDIM]; ip++)

rather than:

	for (ip = &array2d[XSIZE][YSIZE]; ip < &array2d[XSIZE][YSIZE]; ip++)

Alan also correctly spotted the bug.

				Sorry for the confusion,

				Bob Van Valzah
				(...!decvax!ittvax!tpdcvax!bobvan)

P.s. One additional puzzle: can you see why I used "ip = array" in the
single dimensional case and "ip = &array2d[0][0]" in the 2d case?

P.p.s. Just before posting the article, I considered actually compiling
the fragments and testing them.  Now I know that I should have.



More information about the Comp.lang.c mailing list