array side-effect

Dave Zoss c60b-4fd at web-4f.berkeley.edu
Sat Jun 15 04:43:44 AEST 1991


In article <91165.095327PRD3 at psuvm.psu.edu> PRD3 at psuvm.psu.edu writes:
>I have found a real stumper.
>Partial listing follows:
>...
>int CODE_MATRIX[26][25];         //global

(code deleted)

>This last statement changes the value of CODE_MATRIX[26][1]

When declaring arrays in C or C++, the number in brackets specifies the SIZE
of the array.  The indices, therefore, range from 0 to SIZE-1.

The cell CODE_MATRIX[26][1] does not exist.

Dave Zoss		zoss at ocf.berkeley.edu		zoss at icf.llnl.gov



More information about the Comp.lang.c mailing list