Xref: news-dnh.mv.net comp.os.msdos.djgpp:3782 Path: news-dnh.mv.net!mv!news.sprintlink.net!datalytics!news.ahc.ameritech.com!ddsw1!news.mcs.net!bug.rahul.net!a2i!genmagic!goonsquad.spies.com!uuwest!alcyone!max From: max AT alcyone DOT darkside DOT com (Erik Max Francis) Newsgroups: comp.os.msdos.djgpp Subject: Re: wierd "bug" in my program? Date: Sat, 09 Dec 95 12:49:12 PST References: <4ab2nb$b7 AT nntp5 DOT u DOT washington DOT edu> Organization: &tSftDotIotE Lines: 27 To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp aue AT u DOT washington DOT edu (A. Aue) writes: > Help! I'm having a really strange problem with the bridge program I'm > writing under djgpp. . . . ... > for (n=1; n<=13; ++n) > printf("South %d west %d north %d east %d\n", hands[1].cards[n], hands[2].ca > printf("end main."); ... The problem is in this and your other for loops. In C (and C++) arrays are indexed from 0, not from 1. An array of three elements have indexes 0, 1, and 2. You should change your for loops to read for (n = 0; n < 13; ++n) ... (There may be other problems with your program; I stopped looking when I found this.) Erik Max Francis, &tSftDotIotE && uuwest!alcyone!max, max AT alcyone DOT darkside DOT com San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade _Omnia quia sunt, lumina sunt._ && GIGO Omega Psi && http://www.spies.com/max/ "The Creator Raven looked at Man and was . . . surprised to find that this strange new being was so much like himself." -- Eskimo creation myth