array side-effect

Kevin Sullivan KQS at psuvm.psu.edu
Sat Jun 15 07:43:58 AEST 1991


Two problems here:

In article <91165.095327PRD3 at psuvm.psu.edu>, <PRD3 at psuvm.psu.edu> says:
>...
>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

First: an array declared as a[SIZE] goes from a[0] to a[SIZE-1]; a[SIZE]
is undefined (and in thic case points to the first element of the next
array).

second:  "9" evaluates to a (const char *), not a char.  But perhaps
you meant '9', which is a char (actually an int).


     Kevin Sullivan                       BITNET: KQS at PSUVM
     Student Consultant - CAC           INTERNET: kqs at vm.psu.edu
     Penn State University
                                        Old programmers don't die...they
I don't speak for Penn State...         just branch to a new address.
Penn State doesn't speak for me.



More information about the Comp.lang.c mailing list