From: DBI To: "'djgpp AT delorie DOT com'" Subject: Re:Why doesn't this code work? Date: Thu, 04 Apr 96 13:20:00 PST Message-ID: <31643D6F@macduff.ficsgrp.com> Encoding: 28 TEXT, 39 UUENCODE Dave Calvin said : >Anyway, here's the code: > >#include > >void main(void) >{ > int array1[50][50]; > int array2[2]; > int i,j; > > for(i=0; i<50; i++) > for(j=0; j<50; j++) > array1[i][j] = 0; > > array2[0] = 1; > array2[1] = 2; > cout << array2[(array1[i][j])] << endl; >} after the for(..) loop i and j have value 50 and array1 has range [0-49][0-49]. So you're accessing memory outside of array1 ... Dominique Biesmans DBI AT ficsgrp DOT com Dominique DOT Biesmans AT ping DOT be The following binary file has been uuencoded to ensure successful transmission. Use UUDECODE to extract. begin 600 WINMAIL.DAT M>)\^(BL+`0:0"``$```````!``$``0>0!@`(````Y`0```````#H``$(@`<` M&````$E032Y-:6-R;W-O9G0 AT 36%I;"Y.;W1E`#$(`0V`!``"`````@`"``$$ M@`$`'P```%)E.E=H>2!D;V5S;B=T('1H:7,@8V]D92!W;W)K/P"R"@$%@`,` M#@```,P'!``$``T`%``I``0`*0$!((`#``X```#,!P0`!``-`!``)P`$`",! M`0F``0`A````0SDV030Q1C4Q0CA%0T8Q,3 AT Q-$8P,#@P0S AT Q1D0X,$(`.0``,P`0```!(```!D:F=P<$!D96QO2!D;V5S M;B=T('1H:7,@8V]D92!W;W)K/P```@%Q``$````6`````;LB&,'8]4%JRHX; M$<^!3P"`R!_8"P```P`&$$"8E!`#``<05P$``!X`"!`!````90```$1!5D5# M04Q624Y304E$.D%.65=!62Q(15)%4U1(14-/1$4Z(TE.0TQ51$4\24]35%)% M04U(5D])1$U!24XH5D])1"E)3E1!4E)!63$U,#4P.TE.5$%24D%9,C([24Y4 M22Q*.T8``````@$)$`$````,`@``"`(``+<#``!,6D9U?"I(4_\`"@$/`A4" MJ`7K`H,`4`+R"0(`8V@*P'-E=#(W!@`&PP*#,@/%`@!P)S=&5M`H,S M]P+D!Q,"@'T*@`C/"=D"@*<*@0VQ"V!N9P'0- AT WP!PL*%%$+\2!$879EE"!# M!T!V"X`@7=A>2P@:`20U&4G!"!T&_`@!:`-L-4: M=CX:]B,+@&,*0`VP,"`\:6\3P!8086W,+F@=9QKV=F\:00#`E0N`*"!"*1KV M7'L:]EX@(E4+@`5`"L!R&[`QT%LU,%TC\MGP4C!FDCH&I= M(#T AT OQ<0)V\N6B60(Y`O AT 3$EW[4E13$O80&`!)`<4RCB+BXI\B`5H&]P(L`C`#=`+!#; M&^`92`U(;,`D!Y1;V8]1CL@+AJ,ID0#<`N` M:7$\L4((D`IS`X%S0K9"24!F2&EC