This is a code snippet. The code compiles and runs, but I cannot show everything in this limited space.At any rate, the offset from the base address of dBase is computed incorrectly, i.e., when i is non-zero, the base address of "points" is not correct. I have analyzed the assembly code extensively & an incorrect size of "element" is used when multiplying by i to get the offset to the ith element. In the failing statement (below), am I referencing the ith member of dBase and the jth member of points correctly? If the reference is made correctly, can anyone offer some insightful comments. A bug in the compiler comes to mind but I've found that is not usually the case. A useful answer is not one that suggests a work-around.
An array of structures thus:
struct element {
char team[30];
int teamClass;
int teamIndex;
int opponentGameIndex[NO_GAMES];
int points[NO_GAMES];
int gameNumberIndex;
};
struct element dBase[NO_ELEMENTS];
This is the C code statement that fails:
dBase[i].points[j] = -1;