I use the following two lines of code:
enum bus_sigs { REG0, REGA, REGB, REGC, REGD };
short bus[5];
The purpose is to index the array of shorts with the enum names. For example, I use: bus[REGA]
.
I am getting weird behavior: if I use bus[REGC]
I am getting weird values as if I am fetching data from beyond the array memory range. If I then update the second line to:
short bus[10];
The behavior is again as expected. But this makes no sense to me. I am only ever assigning to 5 members in the bus
array.
What am I not getting?