Hmm the for loop syntax is as followed
for(int x = 0; x <= 100; ++x)
for(Variable ; Repeat While; Increment Variable)
And that's your standard For loop
Yours should be:
Code:
for(i=1; i<=nruns; i++)
{
for(j=1; j<=nsims; j++)
{
if(T_mle[i][j] == 0.0)
{
for(k=1; k<=nsims && k!=j && T_mle[i][k]!=0.0; k++)
//If that's what you wanted.
{
T_mle[i][j]+=T_mle[i][k];
}
T_mle[i][j]=T_mle[i][j]/(nsims-p);
}
}
}
However it is always wiser to keep the for loop statement simple, so it would be better if you skipped or exited the for loop in the body as Daved stated.
I'll let you do that part though.