Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod!caen!hellgate.utah.edu!dog.ee.lbl.gov!nosc!crash!kevin@crash.cts.com From: kevin@crash.cts.com (Kevin Hill) Newsgroups: comp.sys.mac.programmer Subject: For Loops, something crazy! Message-ID: <6934@crash.cts.com> Date: 15 Jan 91 10:01:08 GMT Sender: root@crash.cts.com Lines: 27 for(j = -1;j < 2;j++) { for(k = -1;k < 2;k++) { printf("%3d %3d\t",j,k); i++; surround[i] = track[gx+k][gy+j]; if ( (gx+k) < 0) surround[i] = -1; if ( (gx+k) > GXMAX) surround[i] = -1; if ( (gy-j) < 0) surround[i] = -1; if ( (gy-j) > GYMAX) surround[i] = -1; } } This programmer is very frustrated. This loop, programmed in THINK C dos not seem to work. It loops a couple of extra times, and I cannot figure out why. If is supposed to loop three times for a total of i = 9. [B[D[B[A[B.