From: "Alexei A. Frounze" Newsgroups: comp.os.msdos.djgpp Subject: Re: Code or Compiler? Date: Sun, 4 Mar 2001 01:31:59 -0500 Lines: 57 Message-ID: <97sner$qc0mh$1@ID-57378.news.dfncis.de> References: <3AA195B1 DOT ED50BFD7 AT __mad DOT scientist DOT com--> NNTP-Posting-Host: nas-202-171.rochester.navipath.net (64.20.202.171) X-Trace: fu-berlin.de 983687452 27656913 64.20.202.171 (16 [57378]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Maybe I missed something in C/C++, but why do you address data elements like data[i,j]? Shouldn't it be data[i][j]? -- Alexei A. Frounze alexfru [AT] chat [DOT] ru http://alexfru.chat.ru http://members.xoom.com/alexfru/ http://welcome.to/pmode/ "Anderson" <--anderson DOT comp__ AT __mad DOT scientist DOT com--> wrote in message news:3AA195B1 DOT ED50BFD7 AT __mad DOT scientist DOT com--... > Hi everybody! > > I was playing with arrays (for matrix calculation) when I've got this > strange error. When I set the value it seems ok, but when I check it > out... it's not there anymore! > Here's the bugged code: > ---------------------------------------- > int X=2; > int Y=2; > for (int i=0; i for (int j=0; j if (i==j) data[i,j]=1; // defines a 2x2 identity matrix > else data[i,j]=0; > cout << data [i,j] <<", "; // SEEMS OK... > } > } > > cout << endl; > > // check it out > for (int i=0; i for (int j=0; j cout << data [i,j] <<", "; // WRONG!!! WHY ??? > } > } > ----------------------------------------- > Any clue? > I'm using djgpp + rhide. > > Thanks a lot! > > Anderson. > (to send me email, please remove underscores/dashes from my address. You > know, spammers are very boring... :-) > > -- > > ========================================= > "Any sufficiently advanced technology is > indistinguishable from magic. " > Arthur C. Clarke >