for loop

Hi,I am in the process of void function that uses for loops to bring up values from array and compare them.
I recognize that it will be possible to simplify my void function using for loop. Please help


here is my void function.


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

void difference(double original [10][10],double comparison [3][3],double score[3])
{
int p,q, x,y;
double score_0,score_1,score_2, differen, sum1=0;
score[0]=0;
score[1]=0;
score[2]=0;
for (p=0;p<7;p++)
{for(q=0;q<7;q++)

________I want to simplify the part below.
differen = original[p][q] - comparison[0][0];
score[0] = score[0] + differen;
score[1] = score[1] + fabs(differen);
score[2] = score[2] + (differen*differen);


differen = original[p+1][q] - comparison[1][0];
score[0] = score[0] + differen;
score[1] = score[1] + fabs(differen);
score[2] = score[2] + (differen*differen);

differen = original[p+2][q] - comparison[2][0];
score[0] = score[0] + differen;
score[1] = score[1] + fabs(differen);
score[2] = score[2] + (differen*differen);

differen = original[p][q+1] - comparison[0][1];
score[0] = score[0] + differen;
score[1] = score[1] + fabs(differen);
score[2] = score[2] + (differen*differen);

differen = original[p+1][q+1] - comparison[1][1];
score[0] = score[0] + differen;
score[1] = score[1] + fabs(differen);
score[2] = score[2] + (differen*differen);

differen = original[p+2][q+1] - comparison[2][1];
score[0] = score[0] + differen;
score[1] = score[1] + fabs(differen);
score[2] = score[2] + (differen*differen);

differen = original[p][q+2] - comparison[0][2];
score[0] = score[0] + differen;
score[1] = score[1] + fabs(differen);
score[2] = score[2] + (differen*differen);

differen = original[p+1][q+2] - comparison[1][2];
score[0] = score[0] + differen;
score[1] = score[1] + fabs(differen);
score[2] = score[2] + (differen*differen);

differen = original[p+2][q+2] - comparison[2][2];
score[0] = score[0] + differen;
score[1] = score[1] + fabs(differen);
score[2] = score[2] + (differen*differen);
}

}

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Is this possible? This is basically comparing one 3*3 array to 3*3 part of 10*10 array.
Please help me. Thank you.
Topic archived. No new replies allowed.