array side-effect
PRD3 at psuvm.psu.edu
PRD3 at psuvm.psu.edu
Fri Jun 14 23:53:27 AEST 1991
I have found a real stumper.
Partial listing follows:
...
int CODE_MATRIX[26][25]; //global
char INMOD1[50][3]; //global
...
int mod_loop=0; //local
...
mod_loop++;
INMOD1[mod_loop][0]="9"; //mod_loop is 1
This last statement changes the value of CODE_MATRIX[26][1]
from -9 to some large random number. Rows 1-25 are unchanged.
CODE_MATRIX[26][0] and CODE_MATRIX[26][2] may also be affected
but I forgot to check. I have tried '9' instead of "9"
and I have used strcpy to replace the whole line. The problem persists.
I am using Borland Turbo C++ on a 386Clone running DOS.
More information about the Comp.lang.c
mailing list