Here is a section of some code I have. Im getting an error uninitialized local variable 'j' used and I dont see it. as far as I can tell it is being used. Can someone please help?
float Calculate(Element ElmAry[30], Formula FormAry[30])
{
int i;
int j;
float MoleWT = 0;
float MoleSum = 0;
char e1;
char e2;
char f1;
char f2;
for(i = 0; i < 30; i++) {
f1 = FormAry[j].Element1;
f2 = FormAry[j].ElementA;
e1 = ElmAry[i].eN1;
e2 = ElmAry[i].eN1;
if(e1 == f1 && e2 == f2) {
MoleWT = ElmAry[i].Weight * FormAry[j].Atom;
MoleSum = MoleSum + MoleWT;
j++;
}
}
return MoleSum;
}